minimal-cli-parser
![npm package](https://nodei.co/npm/minimal-cli-parser.png?downloads=true)
![Vulnerabilities](https://snyk.io/test/npm/minimal-cli-parser/badge.svg?style=flat-square)
The command-line parser used by the package minimal-cli.
- Useful for parsing
process.argv
- Supports regular flags
--flag
and shorthand flags -f
- Automatically infers variable types by default
- Converts hyphenated flags to camel case
Installation
$ npm install minimal-cli-parser --save
Usage
const parser = require('minimal-cli-parser');
const args = ['command', '--alpha', '1', '--beta', '-g', '2', '--delta=value'];
const parsed = parser(args);
console.log(parsed);
Output:
{
"_": ["command"],
"alpha": 1,
"beta": true,
"g": 2,
"delta": "value"
}
License
MIT License
Copyright (c) 2019 Josh Crozier