Parse command line arguments for the UNIX style
optArguments([{
opt: String, // a char to short option, like -x
option: String, // a word to long option, like --xxxx=yyyy
}, ...])
const optArguments = require('opt-arguments');
let arguments = optArguments([{
opt: 'h',
option: 'help'
}, {
opt: 'o',
option: 'out'
}]);
console.log(JSON.stringify(arguments));
node test.js -o obj.o src.src
or node test.js --out=obj.o src.src
{
"options": {
"out": "obj.o"
},
"default": ["src.src"]
}