CLI scripts micro engine
#!/usr/bin/env nodeconst microcli = const cli = ;
$ script.js -a --foo=bar --boo abc def
OPTIONS {a: true, foo: 'bar', boo: true }
P1 abc
P2 def
$ script.js --help
Usage: script.js
Script doc
Annotations
#!/usr/bin/env nodeconst microcli = const cli = ;
$ script.js --help
Usage: script.js [options] [p1 p2]
Basic script description
Options:
-a description for a option
--foo description for foo option
Examples:
some examples
Annotations plays part also in validating process. So if
option which does not exist in annotations is provided, microcli
will
throw an error:
$ script.js --bar
Illegal option: --bar
Available options: -a --foo
Type "script.js --help" for more information
Also each annotation is optional and custom annotations like examples
(basically other than description, params and options) will be treated
in --help
content as additional header with string value.
Commands
$ script.js status --foo abc
OPTIONS {foo: true}
P abc
$ script.js branch --help
Usage: branch [options] [p]
Basic script description
$ script.js --foo abc
OPTIONS {foo: true}
P abc
#!/usr/bin/env nodeconst microcli = const main = const status = const branch =
Custom --help
You can provide help
function to cli
call, which can generate
custom help message, having annotations object:
#!/usr/bin/env nodeconst microcli = const cli = ;