nomnom
nomnom copied to clipboard
New option type: map
Hello,
It would be useful to implement support for new option type (a possible name is map) that will allow gathering values of options with specified prefix into object. Specification field map could have string or boolean value. In the former case string specifies prefix to detect appropriate options. In the case of true value prefix is equal to full option name (value of specification field full).
Example:
var opts = require("nomnom")
.option('application', {
map: 'app',
help: 'Application data'
})
.option('build', {
map: true,
help: 'Build settings'
})
.parse();
So
--app-name=MyApp --app-dir=some/path --build-mode=standalone --build-target=browser
would give:
{
"application": {
"name": "MyApp",
"dir": "some/path"
},
"build": {
"mode": "standalone",
"target": "browser"
}
}
Thanks, Denis
:+1: