argv-user-input

1.3.2 • Public • Published


argv-user-input

Tiny function who parse user data from CLI

NPM version Package size Dependencies devDependencies Status code style: prettier


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.

Tostee Lucas
Tostee Lucas

💻

License ⚖️

@MIT


Package Sidebar

Install

npm i argv-user-input

Weekly Downloads

0

Version

1.3.2

License

MIT

Unpacked Size

5.18 kB

Total Files

3

Last publish

Collaborators

  • luctst