CLI for generating, building, and releasing oclif CLIs. Built by Salesforce.
This is a framework for building CLIs in Node.js. This framework was built out of the Heroku CLI but generalized to build any custom CLI. It's designed both for single-file CLIs with a few flag options, or for very complex CLIs that have subcommands (like git or heroku).
See the docs for more information.
The Getting Started tutorial is a step-by-step guide to introduce you to oclif. If you have not developed anything in a command line before, this tutorial is a great place to get started.
--help
to the CLI to get help such as flag options and argument information. This information is also automatically placed in the README whenever the npm package of the CLI is published. See the multi-command CLI example
ts-node
to run the plugins enabling you to use TypeScript with minimal-to-no boilerplate needed for any oclif CLI.$ heroku info --app=<tab><tab> # will complete with all the Heroku apps a user has in their account
Currently, Node 18+ is supported. We support the LTS versions of Node. You can add the node package to your CLI to ensure users are running a specific version of Node.
If you have been using version 1 of the oclif
CLI there are some important differences to note when using the latest version.
oclif multi
, oclif plugin
, and oclif single
have all been removed in favor of oclif generate
, which generates an oclif based CLI using the hello-world example repo.
oclif hook
is now oclif generate:hook
oclif command
is now oclif generate:command
Version 2 now includes all the commands from the oclif-dev
CLI. This means that you can now use a single CLI for all your oclif needs. These commands include:
oclif manifest
oclif pack
oclif pack:deb
oclif pack:macos
oclif pack:win
oclif upload
(formerly known as oclif-dev publish
)oclif upload:deb
(formerly known as oclif-dev publish:deb
)oclif upload:macos
(formerly known as oclif-dev publish:macos
)oclif upload:win
(formerly known as oclif-dev publish:win
)oclif readme
Creating a CLI:
$ npx oclif generate mynewcli
? npm package name (mynewcli): mynewcli
$ cd mynewcli
$ ./bin/run.js --version
mynewcli/0.0.0 darwin-x64 node-v9.5.0
$ ./bin/run.js --help
USAGE
$ mynewcli [COMMAND]
COMMANDS
hello
help display help for mynewcli
$ ./bin/run.js hello world
hello world! (./src/commands/hello/world.ts)
oclif generate
- generate a new CLIoclif help
- Display help for oclif.oclif manifest
- generates plugin manifest jsonoclif pack
- package an oclif CLI into installable artifactsoclif promote
- promote CLI builds to a S3 release channeloclif readme
- adds commands to README.md in current directoryoclif upload
- upload installable CLI artifacts to AWS S3If you have any suggestions or want to let us know what you think of oclif, send us a message at [email protected]