0.1.0 • Published 6 years ago
minimal-cli-parser v0.1.0
minimal-cli-parser
The command-line parser used by the package minimal-cli.
- Useful for parsing
process.argv - Supports regular flags
--flagand shorthand flags-f - Automatically infers variable types by default
- Converts hyphenated flags to camel case
Installation
$ npm install minimal-cli-parser --saveUsage
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
Copyright (c) 2019 Josh Crozier
