Socket
Book a DemoInstallSign in
Socket

@oclif/core

Package Overview
Dependencies
Maintainers
7
Versions
443
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oclif/core

base library for oclif CLIs

Source
npmnpm
Version
2.8.11
Version published
Weekly downloads
3M
-29.89%
Maintainers
7
Weekly downloads
 
Created
Source

@oclif/core

base library for oclif CLIs

Version Downloads/week License

Migrating

See the migration guide for an overview of breaking changes that occurred between v1 and v2.

CLI UX

The ux README contains detailed usage examples of using the ux export.

Usage

We strongly encourage you generate an oclif CLI using the oclif cli. The generator will generate an npm package with @oclif/core as a dependency.

You can, however, use @oclif/core in a standalone script like this:

#!/usr/bin/env ts-node

import * as fs from 'fs'
import {Command, Flags} from '@oclif/core'

class LS extends Command {
  static description = 'List the files in a directory.'
  static flags = {
    version: Flags.version(),
    help: Flags.help(),
    dir: Flags.string({
      char: 'd',
      default: process.cwd(),
    }),
  }

  async run() {
    const {flags} = await this.parse(LS)
    const files = fs.readdirSync(flags.dir)
    for (const f of files) {
      this.log(f)
    }
  }
}

LS.run().then(() => {
  require('@oclif/core/flush')
}, () => {
  require('@oclif/core/handle')
})

Then run it like this:

$ ts-node myscript.ts
...files in current dir...

Keywords

oclif

FAQs

Package last updated on 01 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts