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 0.5.0 to 0.5.1

2

lib/command-line-args.js

@@ -114,3 +114,3 @@ "use strict";

if (typeof option.type === "function" && option.type === Array){
value = a.spliceWhile(argv, 0, /^\w+/);
value = a.spliceWhile(argv, 0, /^[^\-]/);
} else {

@@ -117,0 +117,0 @@ if (isOption(argv[0])){

{
"name": "command-line-args",
"version": "0.5.0",
"version": "0.5.1",
"description": "Command-line parser, usage text producer",

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

"test": "tap test/*.js",
"docs": "jsdoc2md --index -t jsdoc2md/README.hbs lib/command-line-args.js > README.md"
"docs": "jsdoc2md -t jsdoc2md/README.hbs lib/command-line-args.js > README.md; echo"
},

@@ -25,3 +25,3 @@ "keywords": [

"devDependencies": {
"jsdoc-to-markdown": "^0.2.1",
"jsdoc-to-markdown": "^0.5",
"tap": "^0.4.9"

@@ -32,3 +32,3 @@ },

"handlebars": "^2.0.0-alpha.4",
"handlebars-ansi": "0.0.2",
"handlebars-ansi": "~0.1.0",
"nature": "~0.5",

@@ -35,0 +35,0 @@ "object-tools": "^1.0.0",

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

{}
$ node app.js -v
{ verbose: true }
$ node app.js README.md package.json
{ files: [ 'README.md', 'package.json' ] }
$ node app.js README.md package.json -v
{ verbose: true, files: [ 'README.md', 'package.json' ] }
$ node app.js --help

@@ -65,6 +69,2 @@

#API Reference
<a name="module_command-line-args"></a>
##command-line-args
**Example**

@@ -79,7 +79,21 @@ ```js

```
**Symbols**
<a name="module_command-line-args"></a>
##class: CliArgs ⏏
**Members**
* [class: CliArgs ⏏](#module_command-line-args)
* [new CliArgs(options)](#module_command-line-args)
* [cli.parse([argv])](#module_command-line-args#parse)
* [cli.getUsage(options)](#module_command-line-args#getUsage)
* [\~type: OptionDefinition](#module_command-line-args.OptionDefinition)
* [type: cli~OptionDefinition](#module_command-line-args.OptionDefinition)
<a name="module_command-line-args"></a>
###new CliArgs(options)
A constructor function, taking your desired command-line option definitions as input, returning an instance of `command-line-args` which you can `parse()` or `getUsage()`.
**Params**
- options [Array.&lt;OptionDefinition&gt;](#module_command-line-args.OptionDefinition) - list of option definitions
<a name="module_command-line-args#parse"></a>

@@ -115,2 +129,3 @@ ###cli.parse([argv])

```
<a name="module_command-line-args#getUsage"></a>

@@ -128,3 +143,3 @@ ###cli.getUsage(options)

<a name="module_command-line-args.OptionDefinition"></a>
###\~type: OptionDefinition
###type: cli~OptionDefinition
Defines an option

@@ -134,26 +149,4 @@

**Type**: `object`
<a name=""></a>
###name
the option name, used as the long option (e.g. `--name`)
**Type**: `string`
<a name=""></a>
###type
an optional function (e.g. `Number` or a custom function) used as a setter to enforce type.
**Type**: `function`
<a name=""></a>
###alias
a single character alias, used as the short option (e.g. `-n`)
**Type**: `string`
<a name=""></a>
###defaultOption
if values are specified without an option name, they are assigned to the defaultOption
**Type**: `boolean`
<a name=""></a>
###description
used in the usage guide
**Type**: `string`
*documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown)*.

@@ -41,1 +41,9 @@ var test = require("tap").test;

});
test("handles arrays with relative paths", function(t){
var argv = [ "--colours", "../what", "../ever" ];
t.deepEqual(cliArgs(optionDefinitions).parse(argv), {
colours: [ "../what", "../ever" ]
});
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