command-line-args
Advanced tools
Comparing version 0.5.3 to 0.5.4
@@ -13,3 +13,3 @@ var cliArgs = require("../"); | ||
{ | ||
name: "colour", alias: "c", | ||
name: "colour", alias: "c", value: "red", | ||
description: "you can specify a colour which will be displayed appropriately" | ||
@@ -26,3 +26,3 @@ }, | ||
var argv = cli.parse(); | ||
var usage = cli.usage({ | ||
var usage = cli.getUsage({ | ||
header: require("../package.json").description, | ||
@@ -29,0 +29,0 @@ columns: [ 24, 15 ] |
@@ -10,3 +10,3 @@ var cliArgs = require("../"); | ||
var options = cli.parse(), | ||
usage = cli.usage({ | ||
usage = cli.getUsage({ | ||
header: "A synopsis application.", | ||
@@ -13,0 +13,0 @@ footer: "For more information, visit http://example.com" |
@@ -46,3 +46,3 @@ var cliArgs = require("../"); | ||
var argv = cli.parse(); | ||
var usage = cli.usage({ | ||
var usage = cli.getUsage({ | ||
title: "local-web-server", | ||
@@ -49,0 +49,0 @@ header: "Lightweight static web server, zero configuration. Perfect for front-end devs.", |
{ | ||
"name": "command-line-args", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"description": "Command-line parser, usage text producer", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/75lb/command-line-args.git", |
@@ -78,29 +78,29 @@ [![view on npm](http://img.shields.io/npm/v/command-line-args.svg)](https://www.npmjs.org/package/command-line-args) | ||
<a name="exp_module_command-line-args"></a> | ||
##class: CliArgs ⏏ | ||
**Members** | ||
* [command-line-args](#module_command-line-args) | ||
* [class: CliArgs](#exp_module_command-line-args--CliArgs) ⏏ | ||
* [new CliArgs(options)](#new_module_command-line-args--CliArgs_new) | ||
* _instance_ | ||
* [.parse([argv])](#module_command-line-args--CliArgs#parse) ⇒ <code>object</code> | ||
* [.getUsage(options)](#module_command-line-args--CliArgs#getUsage) ⇒ <code>string</code> | ||
* _inner_ | ||
* [type: ~OptionDefinition](#module_command-line-args--CliArgs..OptionDefinition) → <code>object</code> | ||
* [class: CliArgs ⏏](#exp_module_command-line-args) | ||
* [new CliArgs(options)](#exp_new_module_command-line-args) | ||
* [cli.parse([argv])](#module_command-line-args#parse) | ||
* [cli.getUsage(options)](#module_command-line-args#getUsage) | ||
* [type: cli~OptionDefinition](#module_command-line-args..OptionDefinition) | ||
<a name="exp_new_module_command-line-args"></a> | ||
###new CliArgs(options) | ||
<a name="exp_module_command-line-args--CliArgs"></a> | ||
### class: CliArgs ⏏ | ||
<a name="new_module_command-line-args--CliArgs_new"></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** | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| options | <code>[Array.<OptionDefinition>](#module_command-line-args--CliArgs..OptionDefinition)</code> | list of option definitions | | ||
- options <code>[Array.<OptionDefinition>](#module_command-line-args..OptionDefinition)</code> - list of option definitions | ||
<a name="module_command-line-args#parse"></a> | ||
###cli.parse([argv]) | ||
<a name="module_command-line-args--CliArgs#parse"></a> | ||
#### cliArgs.parse([argv]) ⇒ <code>object</code> | ||
Returns a flat, or grouped object containing the values set at the command-line | ||
**Params** | ||
| Param | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| [argv] | <code>object</code> | <code>process.argv</code> | Optional argv array, pass to override the default `process.argv`. | | ||
- \[argv=process.argv\] `object` - Optional argv array, pass to override the default `process.argv`. | ||
**Returns**: `object` | ||
**Example** | ||
@@ -127,16 +127,14 @@ Output from `parse()` looks something like this: | ||
``` | ||
<a name="module_command-line-args--CliArgs#getUsage"></a> | ||
#### cliArgs.getUsage(options) ⇒ <code>string</code> | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| options | <code>object</code> | options for template | | ||
| options.title | <code>string</code> | a title | | ||
| options.header | <code>string</code> | a header | | ||
| options.footer | <code>string</code> | a footer | | ||
| options.forms | <code>array</code> | the invocation forms | | ||
<a name="module_command-line-args#getUsage"></a> | ||
###cli.getUsage(options) | ||
**Params** | ||
- options `object` - options for template | ||
- title `string` - a title | ||
- header `string` - a header | ||
- footer `string` - a footer | ||
- forms `array` - the invocation forms | ||
**Returns**: `string` | ||
<a name="module_command-line-args..OptionDefinition"></a> | ||
###type: cli~OptionDefinition | ||
<a name="module_command-line-args--CliArgs..OptionDefinition"></a> | ||
#### type: CliArgs~OptionDefinition → <code>object</code> | ||
Defines an option | ||
@@ -146,12 +144,13 @@ | ||
- name `string` - the option name, used as the long option (e.g. `--name`) | ||
- type `function` - an optional function (e.g. `Number` or a custom function) used as a setter to enforce type. | ||
- alias `string` - a single character alias, used as the short option (e.g. `-n`) | ||
- defaultOption `boolean` - if values are specified without an option name, they are assigned to the defaultOption | ||
- description `string` - used in the usage guide | ||
| Name | Type | Description | | ||
| --- | --- | --- | | ||
| name | <code>string</code> | the option name, used as the long option (e.g. `--name`) | | ||
| type | <code>function</code> | an optional function (e.g. `Number` or a custom function) used as a setter to enforce type. | | ||
| alias | <code>string</code> | a single character alias, used as the short option (e.g. `-n`) | | ||
| defaultOption | <code>boolean</code> | if values are specified without an option name, they are assigned to the defaultOption | | ||
| description | <code>string</code> | used in the usage guide | | ||
**Scope**: inner typedef of [command-line-args](#module_command-line-args) | ||
**Type**: `object` | ||
*documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown)*. |
Sorry, the diff of this file is not supported yet
30453
154