parses command line arguments passed to node.js
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.gitignore
.npmignore
README.md
circle.yml
esdoc.json
npm-debug.log
package.json

README.md

args-parser

Parses command line arguments passed to node.js.

CircleCI codecov ESDoc

Note that this package is still under heavy development.

Installation

Run npm install [--save[-dev]] @ls-age/args-parser to install this module.

Usage

Basic usage:

import parseArgs from '@ls-age/parse-args';

const args = parseArgs(
  ['non-option', '--number', '13', '--bool'],
  {
    options: {
      number: { type: 'number' },
      bool: 'Description of "bool" option'
    }
  }
);

console.log(args._); // logs ['non-option']
console.log(args.number); // logs `13`
console.log(args.test); // logs `true`

Look at the docs and tests for more detailed usage examples.