Socket
Socket
Sign inDemoInstall

command-line-args

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

command-line-args - npm Package Compare versions

Comparing version 1.1.0-0 to 1.1.0-1

test/name-equals.js

4

example/typical.js
module.exports = [
{ name: "help", alias: "h", type: Boolean, description: "Display this usage guide." },
{ name: "files", alias: "f", type: String, multiple: true, defaultOption: true, description: "The input files to process" },
{ name: "src", alias: "f", type: String, multiple: true, defaultOption: true, description: "The input files to process" },
{ name: "timeout", alias: "t", type: Number, description: "Timeout value in ms" },
{ name: "log-level", alias: "l", type: String, description: "info, warn or error" }
{ name: "log", alias: "l", type: Boolean, description: "info, warn or error" }
];

@@ -41,2 +41,17 @@ "use strict";

/* expand --option=name style args */
var optEquals = option.optEquals;
if (argv.some(optEquals.test.bind(optEquals))){
var expandedArgs = [];
argv.forEach(function(arg){
var matches = arg.match(optEquals.re);
if (matches){
expandedArgs.push(matches[1], matches[2]);
} else {
expandedArgs.push(arg);
}
});
argv = expandedArgs;
}
/* expand getopt-style combined options */

@@ -52,3 +67,3 @@ var combinedArg = option.combined;

});
}
}

@@ -70,3 +85,6 @@ /* validate input */

if (!t.isDefined(output[def.name])) outputSet(output, def.name, def.getInitialValue())
if (def.isBoolean()) def = null;
if (def.isBoolean()) {
outputSet(output, def.name, true);
def = null;
}

@@ -96,4 +114,4 @@ } else {

a.arrayify(def.group).forEach(function(groupName){
grouped[groupName] = grouped[groupName] || {};
if (t.isDefined(output[def.name])){
grouped[groupName] = grouped[groupName] || {};
grouped[groupName][def.name] = output[def.name];

@@ -100,0 +118,0 @@ }

@@ -15,3 +15,21 @@ "use strict";

/**
@type {string}
* The only required definition property is `name`, so the simplest working example is
* ```js
* [
* { name: "file" },
* { name: "verbose" },
* { name: "depth"}
* ]
* ```
*
* In this case, the value of each option will be either a Boolean or string.
*
* | # | Command line args | parse output |
* | --- | -------------------- | ------------ |
* | 1 | `--file` | `{ file: true }` |
* | 2 | `--file lib.js --verbose` | `{ file: "lib.js", verbose: true }` |
* | 3 | `--verbose very` | `{ verbose: "very" }` |
* | 4 | `--depth 2` | `{ depth: "2" }` |
*
* @type {string}
*/

@@ -21,3 +39,31 @@ this.name = definition.name;

/**
@type {function}
* Take control and be more specific about type..
*
* ```js
* var fs = require("fs");
*
* function FileDetails(filename){
* if (!(this instanceof FileDetails)) return new FileDetails(filename);
* this.filename = filename;
* this.exists = fs.existsSync(filename);
* }
*
* module.exports = [
* { name: "file", type: FileDetails },
* { name: "depth", type: Number }
* ];
* ```
*
* | # | Command line args| parse output |
* | --- | ----------------- | ------------ |
* | 5 | `--file asdf.txt` | `{ file: { filename: 'asdf.txt', exists: false } }` |
*
* in 1, main was passed but is set to null (not true, as before) meaning "no value was specified".
*
* | # | Command line args | parse output |
* | --- | ----------------- | ------------ |
* | 6 | `--depth` | `{ depth: null }` |
* | 6 | `--depth 2` | `{ depth: 2 }` |
*
* @type {function}
*/

@@ -27,4 +73,18 @@ this.type = definition.type;

/**
a single character
@type {string}
* Short option names. Must be a single character.
*
* ```js
* [
* { name: "hot", alias: "h", type: Boolean },
* { name: "discount", alias: "d", type: Boolean },
* { name: "courses", alias: "c" , type: Number }
* ]
* ```
*
* | # | Command line | parse output |
* | --- | ------------ | ------------ |
* | 7 | `-hcd` | `{ hot: true, courses: null, discount: true }` |
* | 7 | `-hdc 3` | `{ hot: true, discount: true, courses: 3 }` |
*
* @type {string}
*/

@@ -34,3 +94,15 @@ this.alias = definition.alias;

/**
@type {boolean}
* ```js
* module.exports = [
* { name: "files", type: String, multiple: true }
* ];
* ```
*
* | # | Command line | parse output |
* | --- | ------------ | ------------ |
* | 8 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
* | 9 | `--files one.js --files two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
* | 10 | `--files *` | `{ files: [ 'one.js', 'two.js' ] }` |
*
* @type {boolean}
*/

@@ -40,3 +112,15 @@ this.multiple = definition.multiple;

/**
@type {boolean}
* ```js
* module.exports = [
* { name: "files", type: String, multiple: true, defaultOption: true }
* ];
* ```
*
* | # | Command line | parse output |
* | --- | ------------ | ------------ |
* | 11 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
* | 11 | `one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
* | 12 | `*` | `{ files: [ 'one.js', 'two.js' ] }` |
*
* @type {boolean}
*/

@@ -46,12 +130,45 @@ this.defaultOption = definition.defaultOption;

/**
@type {string|string[]}
* ```js
* module.exports = [
* { name: "files", type: String, multiple: true, defaultValue: [ "one.js" ] },
* { name: "max", type: Number, defaultValue: 3 }
* ];
* ```
*
* | # | Command line | parse output |
* | --- | ------------ | ------------ |
* | 13 | | `{ files: [ 'one.js' ], max: 3 }` |
* | 14 | `--files two.js` | `{ files: [ 'one.js', 'two.js' ], max: 3 }` |
* | 15 | `--max 4` | `{ files: [ 'one.js' ], max: 4 }` |
*
* @type {*}
*/
this.group = definition.group;
this.defaultValue = definition.defaultValue;
/**
@type {*}
* When your app has a large amount of options it makes sense to organise them in groups. For example, you may want to delegate the `video`and `audio` options to separate 3rd party libraries.
*
* ```js
* module.exports = [
* { name: "verbose", group: "standard" },
* { name: "help", group: [ "standard", "main" ] },
* { name: "compress", group: [ "server", "main" ] },
* { name: "static", group: "server" },
* { name: "debug" }
* ];
* ```
*
* | # | Command line | parse output |
* | --- | ------------ | ------------ |
* | 13 | `--verbose` | `{ _all: { verbose: true }, standard: { verbose: true } }` |
* | 14 | `--debug` | `{ _all: { debug: true }, _none: { debug: true } }` |
* | 15 | `--verbose --debug --compress` | `{ _all: { verbose: true, debug: true, compress: true }, standard: { verbose: true }, server: { compress: true }, main: { compress: true }, _none: { debug: true } }` |
* | 15 | `--compress` | `{ _all: { compress: true }, server: { compress: true }, main: { compress: true } }` |
*
* @type {string|string[]}
*/
this.defaultValue = definition.defaultValue;
this.group = definition.group;
/**
A description for this option.
@type {string}

@@ -58,0 +175,0 @@ */

@@ -24,5 +24,6 @@ "use strict";

return this.short.test(arg) || this.long.test(arg);
}
},
optEquals: new Arg(/^(--[\w-]+)=(.*)/)
};
module.exports = option;
{
"name": "command-line-args",
"version": "1.1.0-0",
"version": "1.1.0-1",
"description": "A library to collect command-line args and generate a usage guide.",

@@ -10,3 +10,3 @@ "repository": "https://github.com/75lb/command-line-args.git",

"test": "tape test/*.js",
"docs": "jsdoc2md -t jsdoc2md/README.hbs lib/*.js node_modules/command-line-usage/lib/usage-options.js > README.md; echo"
"docs": "jsdoc2md -l off -t jsdoc2md/README.hbs lib/*.js > README.md; echo"
},

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

@@ -10,3 +10,13 @@ [![view on npm](http://img.shields.io/npm/v/command-line-args.svg)](https://www.npmjs.org/package/command-line-args)

## Synopsis
First, create a command-line-args instance passing the option definitions your app accepts.
Say your app was run with one of these commands (they are all equalivalent and parse the same)
```
$ my-app --verbose --timeout=1000 --src one.js --src two.js
$ my-app --verbose --timeout 1000 --src one.js two.js
$ my-app -vt 1000 --src one.js two.js
$ my-app -vt 1000 one.js two.js
```
then your app can access the values like this:
1\. First describe the options your app accepts (see [option definitions](#option-definitions)).
```js

@@ -21,3 +31,3 @@ var cliArgs = require("command-line-args");

{
name: "files", description: "The input files to process",
name: "src", description: "The input files to process",
alias: "f", type: String, multiple: true, defaultOption: true

@@ -32,17 +42,13 @@ },

Now, the `cli` instance above has two main operations - `.parse()` and `.getUsage()`.
So if your app was run with a command like this:
```sh
$ my-app -vt 1000 lib/*.js
2\. then collect the command line args using `.parse()`
```js
var options = cli.parse();
```
..then `cli.parse()` would return the command-line options and values in a stucture like this:
`options` now looks like this:
```js
{
files: [
"lib/command-line-args.js",
"lib/definition.js",
"lib/definitions.js",
"lib/option.js"
"one.js",
"two.js"
],

@@ -52,7 +58,16 @@ verbose: true,

}
```
```
and `cli.getUsage(options)` would return:
The [.getUsage()](#module_command-line-args--CliArgs+getUsage) method generates a usage guide:
```js
var usage = cli.usage({
title: "my-app",
description: "Generates something useful",
footer: "Project home: [underline]{https://github.com/me/my-app}"
});
```
a typical app
..for example:
```
my-app
Generates something useful

@@ -64,7 +79,5 @@

Main options
This group contains the most important options.
-h, --help Display this usage guide.
-f, --files <string[]> The input files to process
-v, --verbose Display this usage guide.
-f, --src <string[]> The input files to process
-t, --timeout <number> Timeout value in ms

@@ -75,135 +88,3 @@

## Option definitions
Options are defined as an array of Definition objects. You can walk through all these files yourself by piping each example into the test harness.
### Name
The only required definition property is `name`, so the simplest working example is
```js
[
{ name: "file" },
{ name: "verbose" },
{ name: "depth"}
]
```
In this case, the value of each option will be either a Boolean or string.
#### Examples
| # | Command line args | parse output |
| --- | -------------------- | ------------ |
| 1 | `--file` | `{ file: true }` |
| 2 | `--file lib.js --verbose` | `{ file: "lib.js", verbose: true }` |
| 3 | `--verbose very` | `{ verbose: "very" }` |
| 4 | `--depth 2` | `{ depth: "2" }` |
### Type
Take control and be more specific about type..
```js
var fs = require("fs");
function FileDetails(filename){
if (!(this instanceof FileDetails)) return new FileDetails(filename);
this.filename = filename;
this.exists = fs.existsSync(filename);
}
module.exports = [
{ name: "file", type: FileDetails },
{ name: "depth", type: Number }
];
```
| # | Command line args| parse output |
| --- | ----------------- | ------------ |
| 5 | `--file asdf.txt` | `{ file: { filename: 'asdf.txt', exists: false } }` |
in 1, main was passed but is set to null (not true, as before) meaning "no value was specified".
| # | Command line args | parse output |
| --- | ----------------- | ------------ |
| 6 | `--depth` | `{ depth: null }` |
| 6 | `--depth 2` | `{ depth: 2 }` |
### Alias
Short option names.
```js
[
{ name: "hot", alias: "h", type: Boolean },
{ name: "discount", alias: "d", type: Boolean },
{ name: "courses", alias: "c" , type: Number }
]
```
| # | Command line | parse output |
| --- | ------------ | ------------ |
| 7 | `-hcd` | `{ hot: true, courses: null, discount: true }` |
| 7 | `-hdc 3` | `{ hot: true, discount: true, courses: 3 }` |
### Multiple option values
```js
module.exports = [
{ name: "files", type: String, multiple: true }
];
```
| # | Command line | parse output |
| --- | ------------ | ------------ |
| 8 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
| 9 | `--files one.js --files two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
| 10 | `--files *` | `{ files: [ 'one.js', 'two.js' ] }` |
### Default option
```js
module.exports = [
{ name: "files", type: String, multiple: true, defaultOption: true }
];
```
| # | Command line | parse output |
| --- | ------------ | ------------ |
| 11 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
| 11 | `one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
| 12 | `*` | `{ files: [ 'one.js', 'two.js' ] }` |
### Default option value
```js
module.exports = [
{ name: "files", type: String, multiple: true, defaultValue: [ "one.js" ] },
{ name: "max", type: Number, defaultValue: 3 }
];
```
| # | Command line | parse output |
| --- | ------------ | ------------ |
| 13 | | `{ files: [ 'one.js' ], max: 3 }` |
| 14 | `--files two.js` | `{ files: [ 'one.js', 'two.js' ], max: 3 }` |
| 15 | `--max 4` | `{ files: [ 'one.js' ], max: 4 }` |
### Group
When your app has a large amount of options it makes sense to organise them in groups. For example, you may want to delegate the `video`and `audio` options to separate 3rd party libraries.
```js
module.exports = [
{ name: "verbose", group: "standard" },
{ name: "help", group: [ "standard", "main" ] },
{ name: "compress", group: [ "server", "main" ] },
{ name: "static", group: "server" },
{ name: "debug" }
];
```
| # | Command line | parse output |
| --- | ------------ | ------------ |
| 13 | `--verbose` | `{ _all: { verbose: true }, standard: { verbose: true } }` |
| 14 | `--debug` | `{ _all: { debug: true }, _none: { debug: true } }` |
| 15 | `--verbose --debug --compress` | `{ _all: { verbose: true, debug: true, compress: true }, standard: { verbose: true }, server: { compress: true }, main: { compress: true }, _none: { debug: true } }` |
| 15 | `--compress` | `{ _all: { compress: true }, server: { compress: true }, main: { compress: true } }` |
### Validate
### Validation
Validation is out of scope for this library, which collects values only. Validate using another module or some code of your own. This example uses [test-value](https://github.com/75lb/test-value).

@@ -268,4 +149,2 @@

# API Reference

@@ -278,4 +157,2 @@ ## Modules

<dd></dd>
<dt><a href="#module_usage-options">usage-options</a></dt>
<dd></dd>
</dl>

@@ -315,3 +192,3 @@ <a name="module_command-line-args"></a>

| --- | --- |
| [options] | <code>[usage-options](#module_usage-options)</code> |
| [options] | <code>module:usage-options</code> |

@@ -328,4 +205,4 @@ <a name="module_definition"></a>

* [.defaultOption](#module_definition--Definition+defaultOption) : <code>boolean</code>
* [.defaultValue](#module_definition--Definition+defaultValue) : <code>\*</code>
* [.group](#module_definition--Definition+group) : <code>string</code> &#124; <code>Array.&lt;string&gt;</code>
* [.defaultValue](#module_definition--Definition+defaultValue) : <code>\*</code>
* [.description](#module_definition--Definition+description) : <code>string</code>

@@ -340,128 +217,145 @@

#### definition.name : <code>string</code>
The only required definition property is `name`, so the simplest working example is
```js
[
{ name: "file" },
{ name: "verbose" },
{ name: "depth"}
]
```
In this case, the value of each option will be either a Boolean or string.
| # | Command line args | parse output |
| --- | -------------------- | ------------ |
| 1 | `--file` | `{ file: true }` |
| 2 | `--file lib.js --verbose` | `{ file: "lib.js", verbose: true }` |
| 3 | `--verbose very` | `{ verbose: "very" }` |
| 4 | `--depth 2` | `{ depth: "2" }` |
**Kind**: instance property of <code>[Definition](#exp_module_definition--Definition)</code>
<a name="module_definition--Definition+type"></a>
#### definition.type : <code>function</code>
Take control and be more specific about type..
```js
var fs = require("fs");
function FileDetails(filename){
if (!(this instanceof FileDetails)) return new FileDetails(filename);
this.filename = filename;
this.exists = fs.existsSync(filename);
}
module.exports = [
{ name: "file", type: FileDetails },
{ name: "depth", type: Number }
];
```
| # | Command line args| parse output |
| --- | ----------------- | ------------ |
| 5 | `--file asdf.txt` | `{ file: { filename: 'asdf.txt', exists: false } }` |
in 1, main was passed but is set to null (not true, as before) meaning "no value was specified".
| # | Command line args | parse output |
| --- | ----------------- | ------------ |
| 6 | `--depth` | `{ depth: null }` |
| 6 | `--depth 2` | `{ depth: 2 }` |
**Kind**: instance property of <code>[Definition](#exp_module_definition--Definition)</code>
<a name="module_definition--Definition+alias"></a>
#### definition.alias : <code>string</code>
a single character
Short option names. Must be a single character.
```js
[
{ name: "hot", alias: "h", type: Boolean },
{ name: "discount", alias: "d", type: Boolean },
{ name: "courses", alias: "c" , type: Number }
]
```
| # | Command line | parse output |
| --- | ------------ | ------------ |
| 7 | `-hcd` | `{ hot: true, courses: null, discount: true }` |
| 7 | `-hdc 3` | `{ hot: true, discount: true, courses: 3 }` |
**Kind**: instance property of <code>[Definition](#exp_module_definition--Definition)</code>
<a name="module_definition--Definition+multiple"></a>
#### definition.multiple : <code>boolean</code>
```js
module.exports = [
{ name: "files", type: String, multiple: true }
];
```
| # | Command line | parse output |
| --- | ------------ | ------------ |
| 8 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
| 9 | `--files one.js --files two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
| 10 | `--files *` | `{ files: [ 'one.js', 'two.js' ] }` |
**Kind**: instance property of <code>[Definition](#exp_module_definition--Definition)</code>
<a name="module_definition--Definition+defaultOption"></a>
#### definition.defaultOption : <code>boolean</code>
```js
module.exports = [
{ name: "files", type: String, multiple: true, defaultOption: true }
];
```
| # | Command line | parse output |
| --- | ------------ | ------------ |
| 11 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
| 11 | `one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
| 12 | `*` | `{ files: [ 'one.js', 'two.js' ] }` |
**Kind**: instance property of <code>[Definition](#exp_module_definition--Definition)</code>
<a name="module_definition--Definition+group"></a>
#### definition.group : <code>string</code> &#124; <code>Array.&lt;string&gt;</code>
**Kind**: instance property of <code>[Definition](#exp_module_definition--Definition)</code>
<a name="module_definition--Definition+defaultValue"></a>
#### definition.defaultValue : <code>\*</code>
**Kind**: instance property of <code>[Definition](#exp_module_definition--Definition)</code>
<a name="module_definition--Definition+description"></a>
#### definition.description : <code>string</code>
**Kind**: instance property of <code>[Definition](#exp_module_definition--Definition)</code>
<a name="module_usage-options"></a>
## usage-options
* [usage-options](#module_usage-options)
* [UsageOptions](#exp_module_usage-options--UsageOptions) ⏏
* _instance_
* [.title](#module_usage-options--UsageOptions+title) : <code>string</code> &#124; <code>[textObject](#module_usage-options--UsageOptions..textObject)</code>
* [.description](#module_usage-options--UsageOptions+description) : <code>string</code> &#124; <code>[textObject](#module_usage-options--UsageOptions..textObject)</code>
* [.usage](#module_usage-options--UsageOptions+usage) : <code>object</code>
* [.groups](#module_usage-options--UsageOptions+groups) : <code>object</code>
* [.footer](#module_usage-options--UsageOptions+footer) : <code>string</code> &#124; <code>[textObject](#module_usage-options--UsageOptions..textObject)</code>
* [.hide](#module_usage-options--UsageOptions+hide) : <code>string</code> &#124; <code>Array.&lt;string&gt;</code>
* _inner_
* [~textObject](#module_usage-options--UsageOptions..textObject)
<a name="exp_module_usage-options--UsageOptions"></a>
### UsageOptions ⏏
The class describes all valid options for the `getUsage` function. Inline formatting can be used within any text string supplied using valid [ansi-escape-sequences formatting syntax](https://github.com/75lb/ansi-escape-sequences#module_ansi-escape-sequences.format).
**Kind**: Exported class
<a name="module_usage-options--UsageOptions+title"></a>
#### options.title : <code>string</code> &#124; <code>[textObject](#module_usage-options--UsageOptions..textObject)</code>
The title line at the top of the usage, typically the name of the app. By default it is underlined but this formatting can be overridden by passing a [textObject](#module_usage-options--UsageOptions..textObject).
**Kind**: instance property of <code>[UsageOptions](#exp_module_usage-options--UsageOptions)</code>
**Example**
```js
{
title: {
text: "my-app",
format: [ "bold", "underline" ]
}
}
module.exports = [
{ name: "files", type: String, multiple: true, defaultValue: [ "one.js" ] },
{ name: "max", type: Number, defaultValue: 3 }
];
```
<a name="module_usage-options--UsageOptions+description"></a>
#### options.description : <code>string</code> &#124; <code>[textObject](#module_usage-options--UsageOptions..textObject)</code>
A description to go underneath the title. For example, some words about what the app is for.
**Kind**: instance property of <code>[UsageOptions](#exp_module_usage-options--UsageOptions)</code>
<a name="module_usage-options--UsageOptions+usage"></a>
#### options.usage : <code>object</code>
An array of strings highlighting the main usage forms of the app.
| # | Command line | parse output |
| --- | ------------ | ------------ |
| 13 | | `{ files: [ 'one.js' ], max: 3 }` |
| 14 | `--files two.js` | `{ files: [ 'one.js', 'two.js' ], max: 3 }` |
| 15 | `--max 4` | `{ files: [ 'one.js' ], max: 4 }` |
**Kind**: instance property of <code>[UsageOptions](#exp_module_usage-options--UsageOptions)</code>
**Properties**
**Kind**: instance property of <code>[Definition](#exp_module_definition--Definition)</code>
<a name="module_definition--Definition+group"></a>
#### definition.group : <code>string</code> &#124; <code>Array.&lt;string&gt;</code>
When your app has a large amount of options it makes sense to organise them in groups. For example, you may want to delegate the `video`and `audio` options to separate 3rd party libraries.
| Name | Type | Default |
| --- | --- | --- |
| title | <code>string</code> &#124; <code>[textObject](#module_usage-options--UsageOptions..textObject)</code> | <code>&quot;Usage&quot;</code> |
| format | <code>string</code> &#124; <code>Array.&lt;string&gt;</code> | |
**Example**
```js
{
usage: {
title: "Synopsis",
forms: [
"$ my-app <options> <files>",
"$ my-app [-cvh]"
]
}
}
module.exports = [
{ name: "verbose", group: "standard" },
{ name: "help", group: [ "standard", "main" ] },
{ name: "compress", group: [ "server", "main" ] },
{ name: "static", group: "server" },
{ name: "debug" }
];
```
<a name="module_usage-options--UsageOptions+groups"></a>
#### options.groups : <code>object</code>
Specify which groups to display in the output by supplying an object of key/value pairs, where the key is the name of the group to include and the value is a string or textObject. If the value is a string it is used as the group title. Alternatively supply an object containing a `title` and `description` string.
**Kind**: instance property of <code>[UsageOptions](#exp_module_usage-options--UsageOptions)</code>
**Example**
```js
{
main: {
title: "Main options",
description: "This group contains the most important options."
},
misc: "Miscellaneous"
}
```
<a name="module_usage-options--UsageOptions+footer"></a>
#### options.footer : <code>string</code> &#124; <code>[textObject](#module_usage-options--UsageOptions..textObject)</code>
Displayed at the foot of the usage output.
| # | Command line | parse output |
| --- | ------------ | ------------ |
| 13 | `--verbose` | `{ _all: { verbose: true }, standard: { verbose: true } }` |
| 14 | `--debug` | `{ _all: { debug: true }, _none: { debug: true } }` |
| 15 | `--verbose --debug --compress` | `{ _all: { verbose: true, debug: true, compress: true }, standard: { verbose: true }, server: { compress: true }, main: { compress: true }, _none: { debug: true } }` |
| 15 | `--compress` | `{ _all: { compress: true }, server: { compress: true }, main: { compress: true } }` |
**Kind**: instance property of <code>[UsageOptions](#exp_module_usage-options--UsageOptions)</code>
<a name="module_usage-options--UsageOptions+hide"></a>
#### options.hide : <code>string</code> &#124; <code>Array.&lt;string&gt;</code>
If you want to hide certain options from the output, specify their names here.
**Kind**: instance property of <code>[Definition](#exp_module_definition--Definition)</code>
<a name="module_definition--Definition+description"></a>
#### definition.description : <code>string</code>
A description for this option.
**Kind**: instance property of <code>[UsageOptions](#exp_module_usage-options--UsageOptions)</code>
<a name="module_usage-options--UsageOptions..textObject"></a>
#### options~textObject
Contains text and formatting information.
**Kind**: inner typedef of <code>[UsageOptions](#exp_module_usage-options--UsageOptions)</code>
**Properties**
| Name | Type | Description |
| --- | --- | --- |
| text | <code>string</code> | |
| format | <code>string</code> &#124; <code>Array.&lt;string&gt;</code> | one or more ansi style names from [this list](https://github.com/75lb/ansi-escape-sequences#module_ansi-escape-sequences.style). |
**Kind**: instance property of <code>[Definition](#exp_module_definition--Definition)</code>
* * *
&copy; 2015 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).

@@ -8,5 +8,5 @@ var test = require("tape");

var argv = [ "--array", "1", "2", "3" ];
test("multiple: true", function(t){
test("number multiple: 1", function(t){
var argv = [ "--array", "1", "2", "3" ];
var result = cliArgs(optionDefinitions).parse(argv);

@@ -21,1 +21,13 @@ t.deepEqual(result, {

});
test("number multiple: 2", function(t){
var argv = [ "--array", "1", "--array", "2", "--array", "3" ];
var result = cliArgs(optionDefinitions).parse(argv);
t.deepEqual(result, {
array: [ 1, 2, 3 ]
});
t.notDeepEqual(result, {
array: [ "1", "2", "3" ]
});
t.end();
});

Sorry, the diff of this file is not supported yet

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