cli2json

1.0.0 • Public • Published

cli2json

A tool to help parse your command line arguments and flags into an organized JSON.

Note

cli2json will split commands by each space, so only use this for a tool you know will not need a space, unless you can merge the command and flag together.

Usage

index.js

var parser = require("cli2json");
console.log(parser.parse(process.argv.slice(2).join(" "), {
  readCommandAfter: ["-t", "--test"]
}))
/*
 {
  commands: [
    'index.js'
  ],
  flags: [
  '--test Hello!'
  ]
}
*/

Run this to see it in action:

node . --test Hello!

Readme

Keywords

none

Package Sidebar

Install

npm i cli2json

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

1.99 kB

Total Files

3

Last publish

Collaborators

  • diegab