Need private packages and team management tools?Check out npm Teams »

stdarg

1.0.1 • Public • Published

stdarg

Parse CLI arguments without configuration

Usage

var stdarg = require('stdarg')
var opts = stdarg(process.argv)
 
console.log(opts)
 
// $ node example.js -rn 5 --this="that" --force stuff
// => { _: ['stuff'], r: true, n: '5', this: 'that', force: true}

Goals

This package aims to be a standardized, zero-configuration replacement for minimist. As such, the following features are planned, but not supported yet:

  • Mapping nested properties to nested objects, e.g. cmd --nested.option="value"
  • Grouping recurring flags into array, e.g. cmd --list="first" --list="second"

Some divergences from minimist's default behaviour however are intentional. For example, stdarg makes no attempt to coerce strings to numbers. It is up to the program to decide when this is necessary and when it isn't. Also, arguments will always be evaluated as if using minimist's boolean option.

License

Apache-2.0

Install

npm i stdarg

DownloadsWeekly Downloads

1

Version

1.0.1

License

Apache-2.0

Unpacked Size

15.4 kB

Total Files

6

Last publish

Collaborators

  • avatar