Skip to content

luctst/argv-user-input

Repository files navigation



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


About

Parse user input from cli.

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published