nano-args

1.0.0 • Public • Published

Gitter NPM version Dependency Status License Downloads

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 of Array 0. Short option name
    1. long option name and 'type'
    2. 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);

Readme

Keywords

Package Sidebar

Install

npm i nano-args

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • holixus