Skip to content

berdon/minimist2

Repository files navigation

Minimist2

Build Status NPM Status

Minimist2 is a rewrite of the popular Minimist Javascript library for argument parsing. The library aims to be a drop-in replacement with matching API footprint. It passes all original Minimist unit tests.

Minimist2 is written in TypeScript targetting ES6.

Installing

npm install minimist2

Development

  1. Checkout the code
    git clone git@github.com:berdon/minimist2.git
    npm install
  2. Develop
  3. Run tests
    npm test
  4. Submit a pull request

Using

var argv = require('minimist2')(process.argv.slice(2));
console.dir(argv);
$ node example/parse.js -a beep -b boop
{ _: [], a: 'beep', b: 'boop' }
$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
{ _: [ 'foo', 'bar', 'baz' ],
  x: 3,
  y: 4,
  n: 5,
  a: true,
  b: true,
  c: true,
  beep: 'boop' }