minimist-reverse

1.1.0 • Public • Published

minimist-reverse

The reverse of minimist. This module is meant to construct arguments for running other cli programs.

There are multiple other modules that does this.

This module differs in that it structures the arguments in a specific way. It also includes the _ key values, first in the output. That might very well NOT be what you want. It also outputs a string.

NOTE You probably want to use dargs instead of this module!

Install

npm install minimist-reverse

Use

var minimist = require('minimist')
var mreverse = require('minimist-reverse')

var argv = ['cmd','-a','--foo=bar'] 
assert.equal(mreverse(minimist(argv)), argv.join(' ')) 

var options = {
    _: ['cmd'],
    a: 1,
    b: 'b',
    c: true,
    d: true,
    yay: false,
    foo: [1,2],
    bar: 'baz',
    bad: 'nevah'
})
var excludes = ['bad']
console.log(mreverse(options, excludes))
// => cmd -cd -a=1 -b=b --no-yay --foo=1 --foo=2 --bar=baz

Changelog

1.1.0

  • Indicated similar modules and specifically pointing to dargs as the one to use
  • Added support for transforming key:false -> --no-key
  • Added support for excludes

1.0.0

  • Initial release 🎉

enjoy

Readme

Keywords

Package Sidebar

Install

npm i minimist-reverse

Weekly Downloads

0

Version

1.1.0

License

BSD

Last publish

Collaborators

  • asbjornenge