argv-user-input
v1.3.2
Published
Parse user input from CLI, no big config or API just a tiny function who return commands and options
Downloads
11
Maintainers
Readme
Content
Features ✨
- Parse, split commands and options entry by user.
- Return simple object.
Install 🐙
npm i argv-user-input
Usage 💡
#!/usr/bin/env node
import parseArgvData from 'argv-user-input';
const argvs = parseArgvData();
foo.js
With no commands or options.
$ foo.js
console.log(argvs);
/*
{
commands: [],
options: {},
}
*/
With commands and no option.
$ foo.js start test
console.log(argvs);
/*
{
commands: ['start', 'test'],
options: {},
}
*/
With commands and options.
$ foo.js start test --skip -p ./dev
console.log(argvs);
/*
{
commands: ['start', 'test'],
options: {
skip: true,
p: './dev'
},
}
*/
With option and no command.
$ foo.js --name=foo
console.log(argvs);
/*
{
commands: [],
options: {
name: 'foo'
},
}
*/
Contributing 🍰
Please make sure to read the Contributing Guide before making a pull request. Thank you to all the people who already contributed to this project!
Maintainers 👷
List of maintainers, replace all href
, src
attributes by your maintainers datas.
License ⚖️
@MIT