Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dashdash

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dashdash - npm Package Compare versions

Comparing version 1.7.3 to 1.8.0

examples/custom-option-duration.js

20

CHANGES.md
# node-dashdash changelog
## 1.8.0
- Support `hidden: true` in an option spec to have help output exclude this
option.
## 1.7.3

@@ -34,3 +40,3 @@

- [pull #7] Support for `<parser>.help({helpWrap: false, ...})` option be able
- [pull #7] Support for `<parser>.help({helpWrap: false, ...})` option to be able
to fully control the formatting for option help (by Patrick Mooney) `helpWrap:

@@ -77,13 +83,13 @@ false` can also be set on individual options in the option objects, e.g.:

- Add support for adding custom option types. "examples/custom-option-type.js"
- Add support for adding custom option types. "examples/custom-option-duration.js"
shows an example adding a "duration" option type.
$ node custom-option-type.js -t 1h
$ node custom-option-duration.js -t 1h
duration: 3600000 ms
$ node custom-option-type.js -t 1s
$ node custom-option-duration.js -t 1s
duration: 1000 ms
$ node custom-option-type.js -t 5d
$ node custom-option-duration.js -t 5d
duration: 432000000 ms
$ node custom-option-type.js -t bogus
custom-option-type.js: error: arg for "-t" is not a valid duration: "bogus"
$ node custom-option-duration.js -t bogus
custom-option-duration.js: error: arg for "-t" is not a valid duration: "bogus"

@@ -90,0 +96,0 @@ A custom option type is added via:

@@ -301,2 +301,3 @@ /**

format('config.options.%d.helpWrap', i));
assert.optionalBool(o.hidden, format('config.options.%d.hidden', i));

@@ -577,2 +578,5 @@ if (o.name) {

this.options.forEach(function (o) {
if (o.hidden) {
return;
}
if (o.group !== undefined && o.group !== null) {

@@ -620,3 +624,9 @@ // We deal with groups in the next pass

}
this.options.forEach(function (o, i) {
var i = -1;
this.options.forEach(function (o) {
if (o.hidden) {
return;
}
i++;
if (o.group !== undefined && o.group !== null) {

@@ -623,0 +633,0 @@ if (o.group === '') {

{
"name": "dashdash",
"description": "A light, featureful and explicit option parsing library.",
"version": "1.7.3",
"version": "1.8.0",
"author": "Trent Mick <trentm@gmail.com> (http://trentm.com)",

@@ -6,0 +6,0 @@ "keywords": ["option", "parser", "parsing", "cli", "command", "args"],

@@ -351,3 +351,6 @@ A light, featureful and explicit option parsing library for node.js.

- `hidden` (Boolean). Optional, default false. If true, help output will not
include this option.
# Option group headings

@@ -463,3 +466,3 @@

See "examples/custom-option-type.js" for another example adding a "duration"
See "examples/custom-option-duration.js" for another example adding a "duration"
option type. Please let me know [on twitter](https://twitter.com/trentmick)

@@ -466,0 +469,0 @@ or [with an issue](https://github.com/trentm/node-dashdash/issues/new) if you

@@ -998,2 +998,13 @@ /*

},
// hidden
{
options: [
{names: ['help', 'h'], type: 'bool'},
{names: ['timeout', 't'], type: 'number', hidden: true},
{names: ['version'], type: 'bool'},
],
argv: 'node hidden-opts.js --help',
expectHelp: /-h, --help\n\s+--version/m,
},
];

@@ -1000,0 +1011,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc