alto-command
About
This is a fork of @oclif/command.
The reason for this fork is to change this to allow space-separated subcommands rather than
the heroku-style colon delimited. This is a minimal change, which should allow this to be
used with the rest of the @oclif/*
system.
Note that this accepts both the heroku style and the space-delimited style at the moment.
Notes/Next steps
- This hasn't been particularly heavily tested, at this moment.
- Other parts of the
@oclif/*
system may need to be alto-ized - Would like to set up a "heroku" flag in the package hosting this one, and let that drive whether this does or does not accept colons.
Warning
Consider this situation. You have a command like this:
mycmd topic1 topic2 cmd arg # that is, in heroku-land mycmd topic1:topic2:cmd arg
imagine you mis-type this:
mycmd topic1 topic2 arg
and your arg happens to have the value "cmd". Then this will execute the command when you might have expected an error (this is hardly a surprise in the land of command line interfaces where many things like this can happy, but worth pointing out as a "failure mode" to be aware of)
Name explanation
This is an alternate oclif, which is to say: "alt-oclif", which is to say "alto-clif".
Thanks
Thanks to the @oclif
team and contributors.
There are are lot of great ideas in oclif! Without them, of course, this package wouldn't exist!
Original README info, below
oclif base command
This is about half of the main codebase for oclif. The other half lives in @oclif/config. This can be used directly, but it probably makes more sense to build your CLI with the generator.
Usage
Without the generator, you can create a simple CLI like this:
TypeScript
#!/usr/bin/env ts-node static flags = version: flagsversion help: flags // run with --dir= or -d= dir: flags async { const flags = this let files = fs for let f of files this } LS
JavaScript
#!/usr/bin/env node const fs = const Command flags = async { const flags = this let files = fs for let f of files this } LSflags = version: flagsversion help: flags // run with --dir= or -d= dir: flags LS
Then run either of these with:
$ ./myscript...files in current dir...$ ./myscript --dir foobar...files in ./foobar...$ ./myscript --versionmyscript/0.0.0 darwin-x64 node-v9.5.0$ ./myscript --helpUSAGE $ @oclif/command OPTIONS -d, --dir=dir [default: /Users/jdickey/src/github.com/oclif/command] --help show CLI help --version show CLI version
See the generator for all the options you can pass to the command.