Socket
Socket
Sign inDemoInstall

commander

Package Overview
Dependencies
0
Maintainers
4
Versions
115
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 9.0.0 to 9.1.0

18

lib/option.js

@@ -36,2 +36,3 @@ const { InvalidArgumentError } = require('./error.js');

this.argChoices = undefined;
this.conflictsWith = [];
}

@@ -71,2 +72,19 @@

/**
* Add option name(s) that conflict with this option.
* An error will be displayed if conflicting options are found during parsing.
*
* @example
* new Option('--rgb').conflicts('cmyk');
* new Option('--js').conflicts(['ts', 'jsx']);
*
* @param {string | string[]} names
* @return {Option}
*/
conflicts(names) {
this.conflictsWith = this.conflictsWith.concat(names);
return this;
}
/**
* Set environment variable to check for option value.

@@ -73,0 +91,0 @@ * Priority order of option values is default < env < cli

2

package.json
{
"name": "commander",
"version": "9.0.0",
"version": "9.1.0",
"description": "the complete solution for node.js command-line programs",

@@ -5,0 +5,0 @@ "keywords": [

@@ -392,3 +392,3 @@ # Commander.js

Example files: [options-extra.js](./examples/options-extra.js), [options-env.js](./examples/options-env.js)
Example files: [options-extra.js](./examples/options-extra.js), [options-env.js](./examples/options-env.js), [options-conflicts.js](./examples/options-conflicts.js)

@@ -401,3 +401,4 @@ ```js

.addOption(new Option('-p, --port <number>', 'port number').env('PORT'))
.addOption(new Option('--donate [amount]', 'optional donation in dollars').preset('20').argParser(parseFloat));
.addOption(new Option('--donate [amount]', 'optional donation in dollars').preset('20').argParser(parseFloat))
.addOption(new Option('--disable-server', 'disables the server').conflicts('port'));
```

@@ -414,2 +415,3 @@

--donate [amount] optional donation in dollars (preset: 20)
--disable-server disables the server
-h, --help display help for command

@@ -422,2 +424,5 @@

Options: { timeout: 60, donate: 20, port: '80' }
$ extra --disable-server --port 8000
error: option '--disable-server' cannot be used with option '-p, --port <number>'
```

@@ -424,0 +429,0 @@

@@ -122,2 +122,14 @@ // Type definitions for commander

/**
* Add option name(s) that conflict with this option.
* An error will be displayed if conflicting options are found during parsing.
*
* @example
* ```ts
* new Option('--rgb').conflicts('cmyk');
* new Option('--js').conflicts(['ts', 'jsx']);
* ```
*/
conflicts(names: string | string[]): this;
/**
* Set environment variable to check for option value.

@@ -124,0 +136,0 @@ * Priority order of option values is default < env < cli

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc