paramon
paramon is a tool for parsing command line arguments. Its agenda is to make it nice to make nice command line options.
Usage
paramon currently supports two different methods: readFlags
and readFormat
.
readFlags sorts arguments into arrays based on flags, like this:
example1.js
console;
Input / Output
$ node example1.js storm -xuv halberd hack --xuv rock -a -b --comb bomb tomb
{ '$!extra': [ 'storm', 'hack', 'tomb' ],
x: true,
u: true,
v: 'halberd',
xuv: 'rock',
a: true,
b: true,
comb: 'bomb' }
readFormat
parses arguments based on rules and a format specification. It also automatically generates help message (customizable / removable).
bombshell
var args = ; console;
Input / Output
$ node bombshell --help
Usage:
bombshell filename {options}
Options / flags:
--help -h Shows this screen.
--bomb-path -p The path to the bomb.
--active -a Makes the bomb active.
--altpaths -A Paths to the other bombs.
--names -n Names of the shell and the bomb.
--boo -b Outputs "boo" or the value of this argument.
$ node bombshell tap -a --boo Toop lap --altpaths a b c d --names gumpy dumpy rap -p f/g gap
Toop
{ '$!stray': [ 'tap', 'lap', 'rap', 'gap' ],
bombPath: 'f/g',
shellActive: true,
altPaths: 'a',
names: [ 'gumpy', 'dumpy' ],
boo: 'Toop' }