Popularity
0.3
Stable
Activity
0.0
Stable
4
2
0

Monthly Downloads: 0
Programming language: JavaScript
License: MIT License
Tags: Utilities     Command Line Utilities     Console     Parser     Terminal     CLI     Args     Get-them-args    
Latest version: v1.3.2

get-them-args alternatives and similar modules

Based on the "Command Line Utilities" category.
Alternatively, view get-them-args alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of get-them-args or a related project?

Add another 'Command Line Utilities' Module

README

get-them-args

package version package downloads standard-readme compliant package license make a pull request Greenkeeper badge

Parse argument options

Table of Contents

About

Simple CLI argument parser hacked from minimist that adds support for objects and additional initialization options.

Install

$ npm install --save get-them-args
# Or
$ yarn add get-them-args

Usage

To use, provide arguments as argument:

const parse = require('get-them-args')
const options = {} // Options to be passed. CURRENTLY NONE AVAILABLE

// $ node ./example.js --dir . --command foo
console.log(parse(process.argv.slice(2) ))
// { unknown: [], dir: '.', command: 'foo' }

console.log(parse(process.argv))
// { unknown: [], dir: '.', command: 'foo' }

console.log(parse())
// { unknown: [], dir: '.', command: 'foo' }

For example, if the arguments provided are --hello world --parse=all --no-drugs --make-friends -n 4 -t 5, the function will return:

{ unknown: [],
  hello: 'world',
  parse: 'all',
  drugs: false,
  'make-friends': true,
  n: 4,
  t: 5
}

There is also support for parsing objects:


$ node example.js --headers={"Foo": "5", "bar": "6"}
# { unknown: [], headers: { Foo: 5, bar: 6 } }

All unparsed arguments will end up in the unknown array. The following types of arguments are supported:

--key=value
--key value
--key # true
--no-key # false
-key=value
-key value

Contribute

  1. Fork it and create your feature branch: git checkout -b my-new-feature
  2. Commit your changes: git commit -am 'Add some feature'
  3. Push to the branch: git push origin my-new-feature
  4. Submit a pull request

License

MIT


*Note that all licence references and agreements mentioned in the get-them-args README section above are relevant to that project's source code only.