cmdln
Advanced tools
Comparing version 3.0.0 to 3.0.1
# node-cmdln Changelog | ||
## 3.0.1 | ||
- Allow one to override how option help is formatted for a subcmd by setting | ||
`CLI.prototype.do_<subcmd>.helpOpts = <dashdash helpOpts object>;`. See | ||
supported helpOpts in [the dashdash help config | ||
docs](https://github.com/trentm/node-dashdash#help-config). | ||
- Update to latest dashdash (1.7.1). | ||
## 3.0.0 | ||
@@ -4,0 +14,0 @@ |
@@ -61,3 +61,22 @@ /* | ||
/** | ||
* Return a new object that is a shallow merge of all the given objects. | ||
* Last one wins. Example: | ||
* | ||
* > objMerge({"a":1,"b":2}, {"b":3,"c":4}); | ||
* { a: 1, b: 3, c: 4 } | ||
*/ | ||
function objMerge(/* ... */) { | ||
var merged = {}; | ||
for (var i = 0; i < arguments.length; i++) { | ||
var obj = arguments[i]; | ||
var keys = Object.keys(obj); | ||
for (var k = 0; k < keys.length; k++) { | ||
merged[keys[k]] = obj[keys[k]]; | ||
} | ||
} | ||
return merged; | ||
} | ||
// ---- Errors | ||
@@ -511,4 +530,6 @@ | ||
var parser = new dashdash.Parser({options: func.options}); | ||
var helpOpts = (func.helpOpts | ||
? objMerge(this.helpOpts, func.helpOpts) : this.helpOpts); | ||
help = help.replace('{{options}}', | ||
'Options:\n' + parser.help(this.helpOpts)); | ||
'Options:\n' + parser.help(helpOpts)); | ||
} | ||
@@ -515,0 +536,0 @@ console.log(help.trimRight()); |
{ | ||
"name": "cmdln", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "helper lib for creating CLI tools with subcommands; think `git`, `svn`, `zfs`", | ||
@@ -19,3 +19,3 @@ "author": "Trent Mick (http://trentm.com)", | ||
"verror": "1.5.1", | ||
"dashdash": "1.7.0" | ||
"dashdash": "1.7.1" | ||
}, | ||
@@ -22,0 +22,0 @@ "devDependencies": { |
@@ -168,2 +168,8 @@ `node-cmdln` is a node.js helper lib for creating CLI tools with subcommands | ||
- `CLI.prototype.do_<subcmd>.helpOpts = <dashdash helpOpts object>;` to override | ||
formatting settings for `options` help output for this command. By default | ||
the `helpOpts` passed into the CLI constructor are used. The set of supported | ||
helpOpts are defined by | ||
[dashdash](https://github.com/trentm/node-dashdash#help-config). | ||
- `CLI.prototype.do_<subcmd>.help = <string>;` to set the help string for a | ||
@@ -170,0 +176,0 @@ subcommand. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41540
618
215
+ Addeddashdash@1.7.1(transitive)
- Removeddashdash@1.7.0(transitive)
Updateddashdash@1.7.1