Giter Site home page Giter Site logo

nano-args's Introduction

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);

nano-args's People

Contributors

holixus avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.