1.0.0 • Published 9 years ago
nano-args v1.0.0
nano-args
Process arguments parsing helper function
API
args(help_text, arguments_names, options)
- help_text
String
- arguments_names
Array
- identifier of argument
- options
Array
ofArray
- Short option name
- long option name and 'type'
- option description
There is more details about options format in docs for node-getopt.
Example
var args = require('nano-args');
args = args("\
Usage: node util.js [OPTIONS] <profile> [<theme>]\n\
profile - a device profile name or comma separated(without spaces) list of profiles names.\n\
There's two shortcuts: 'all' and 'tests'. 'all' means all profiles. 'tests' means run\n\
all tests.\n\
Options:\n\
[[OPTIONS]]\n", [ 'profile', 'theme' ], [
[ 'f', 'folder=', 'logs folder path. default value is "'+logs_folder+'"' ],
[ 'F', 'features=', 'features space separated modifiers list like "feat -nopack +web_bridges"' ],
[ 'C', 'components=','components space separated modifiers list like "acl -usb +pptp"' ],
[ 'n', 'ndwrt=', 'ndrwt folder path. default value is "'+ndwrt+'"'],
[ 's', 'server', 'run localhost web server with built web-interface'],
[ 'd', 'debug', 'enable web server debug prompt'],
[ 'H', 'host=', 'host for web server ndm requests'],
[ 'L', 'last=', 'use last run stored arguments'],
[ 'P', 'preset=', 'build preset. (release, host, ...)'],
[ 'h', 'help', 'print usage instruction' ]
]);
console.log(args);
1.0.0
9 years ago