Package Exports
- @oclif/core
- @oclif/core/flush
- @oclif/core/flush.js
- @oclif/core/handle
- @oclif/core/handle.js
- @oclif/core/lib/cli-ux
- @oclif/core/lib/cli-ux/action/spinner
- @oclif/core/lib/cli-ux/action/spinner.js
- @oclif/core/lib/cli-ux/index.js
- @oclif/core/lib/cli-ux/prompt
- @oclif/core/lib/cli-ux/prompt.js
- @oclif/core/lib/cli-ux/styled/table
- @oclif/core/lib/cli-ux/styled/table.js
- @oclif/core/lib/cli-ux/styled/tree
- @oclif/core/lib/cli-ux/styled/tree.js
- @oclif/core/lib/config/plugin
- @oclif/core/lib/config/plugin.js
- @oclif/core/lib/config/util
- @oclif/core/lib/config/util.js
- @oclif/core/lib/errors
- @oclif/core/lib/errors/errors/pretty-print
- @oclif/core/lib/errors/errors/pretty-print.js
- @oclif/core/lib/errors/handle
- @oclif/core/lib/errors/handle.js
- @oclif/core/lib/errors/index
- @oclif/core/lib/errors/index.js
- @oclif/core/lib/flags
- @oclif/core/lib/flags.js
- @oclif/core/lib/help
- @oclif/core/lib/help/command.js
- @oclif/core/lib/help/formatter
- @oclif/core/lib/help/formatter.js
- @oclif/core/lib/help/index.js
- @oclif/core/lib/help/root.js
- @oclif/core/lib/help/util.js
- @oclif/core/lib/index.js
- @oclif/core/lib/interfaces/index.js
- @oclif/core/lib/interfaces/parser
- @oclif/core/lib/interfaces/parser.js
- @oclif/core/lib/main
- @oclif/core/lib/main.js
- @oclif/core/lib/module-loader
- @oclif/core/lib/module-loader.js
- @oclif/core/lib/parser
- @oclif/core/lib/parser/errors
- @oclif/core/lib/parser/errors.js
- @oclif/core/lib/parser/index.js
- @oclif/core/lib/parser/parse
- @oclif/core/lib/parser/parse.js
- @oclif/core/lib/parser/validate
- @oclif/core/lib/parser/validate.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@oclif/core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@oclif/core
base library for oclif CLIs
Migrating
See the v3 migration guide for an overview of breaking changes that occurred between v2 and v3.
See the v2 migration guide for an overview of breaking changes that occurred between v1 and v2.
Migrating from @oclif/config
and @oclif/command
? See the v1 migration guide.
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, flush, handle} 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(async () => {
await flush()
}, async (err) => {
await handle(err)
})
Then run it like this:
$ ts-node myscript.ts
...files in current dir...