cli2json
v1.0.0
Published
A tool to help parse your command line arguments and flags into an organized JSON.
Downloads
7
Readme
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!