0.1.1 • Published 5 years ago
ease-args v0.1.1
ease-args
A lightweight command line arguments parser that can be used nested like docker command line.
Install
npm install ease-args
Example
code
const easeArgs = require("ease-args");
var res = easeArgs(process.argv, {
"help": { type: Boolean, default: true },
"set": { type: String, default: "" },
}, {
"h": "help",
"s": "set",
});
console.log(`res: ${JSON.stringify(res)}`);
command line
node . --set "hello-world" "hello-world" "I am test."
output
res: {"route":"/","options":{"set":"hello-world"},"content":"hello-world","I am test."}