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/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/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/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/index.js
- @oclif/core/lib/util
- @oclif/core/lib/util.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
If you're migrating from the old oclif libraries (@oclif/config
, @oclif/command
, @oclif/error
, @oclif/parser
), see the migration guide.
The @oclif/core
module now also includes the cli-ux
module. Merging cli-ux
into @oclif/core
resolves a circular dependency between the two modules.
See the cli-ux README for instructions on how to replace the cli-ux
module with @oclif/core
.
The cli-ux README also contains detailed usage examples.
Usage
Without the generator, you can create a simple CLI like this:
TypeScript
#!/usr/bin/env ts-node
import * as fs from 'fs'
import {Command, Flags} from '@oclif/core'
class LS extends Command {
static flags = {
version: Flags.version(),
help: Flags.help(),
// run with --dir= or -d=
dir: Flags.string({
char: 'd',
default: process.cwd(),
}),
}
async run() {
const {flags} = await this.parse(LS)
let files = fs.readdirSync(flags.dir)
for (let f of files) {
this.log(f)
}
}
}
LS.run()
.catch(require('@oclif/core/handle'))
Then run either of these with:
$ ./myscript
...files in current dir...
$ ./myscript --dir foobar
...files in ./foobar...
$ ./myscript --version
myscript/0.0.0 darwin-x64 node-v9.5.0
$ ./myscript --help
USAGE
$ @oclif/core
OPTIONS
-d, --dir=dir [default: /Users/jdickey/src/github.com/oclif/core]
--help show CLI help
--version show CLI version
See the generator for all the options you can pass to the command.