argz-parze

1.0.3 • Public • Published

argz-parze Build Status

Command line argument parser

Install

$ npm install argz-parze

Usage

There is a single function exposed which takes an array, this would be akin to process.argv.slice(2), and returns an object. An underscore key holds arguments provided after a terminating sequence '--' and arguments passed without a hyphen type.

const parse = require('argz-parse')

> parse(['-a', 'hey', '-b', 'foo'])
{ _: [], a: 'hey', b: 'foo' }

> parse(['-abc', 'hi'])
{ _: [], c: 'hi', a: true, b: true }

> parse(['--foo', '--bar=3'])
{ _: [], bar: 3, foo: true }

> parse(['--foo', '--bar=baz', '-mtv', '--', 'hello', 'world'])
{ _: [ 'hello', 'world' ],
bar: 'baz',
foo: true,
m: true,
t: true,
v: true }

License

MIT

/argz-parze/

    Package Sidebar

    Install

    npm i argz-parze

    Weekly Downloads

    1

    Version

    1.0.3

    License

    ISC

    Unpacked Size

    7.23 kB

    Total Files

    10

    Last publish

    Collaborators

    • nikkypx