Skip to content

Commit

Permalink
API docs update
Browse files Browse the repository at this point in the history
  • Loading branch information
75lb committed Feb 7, 2018
1 parent 1b5f139 commit 9c07457
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions doc/option-definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const optionDefinitions = [

Where a `type` property is not specified it will default to `String`.

| # | Command line args | .parse() output |
| # | argv input | commandLineArgs() output |
| --- | -------------------- | ------------ |
| 1 | `--file` | `{ file: null }` |
| 2 | `--file lib.js` | `{ file: 'lib.js' }` |
Expand Down Expand Up @@ -71,13 +71,13 @@ const cli = commandLineArgs([
])
```

| # | Command line args| .parse() output |
| # | argv input | commandLineArgs() output |
| --- | ----------------- | ------------ |
| 1 | `--file asdf.txt` | `{ file: { filename: 'asdf.txt', exists: false } }` |

The `--depth` option expects a `Number`. If no value was set, you will receive `null`.

| # | Command line args | .parse() output |
| # | argv input | commandLineArgs() output |
| --- | ----------------- | ------------ |
| 2 | `--depth` | `{ depth: null }` |
| 3 | `--depth 2` | `{ depth: 2 }` |
Expand All @@ -97,7 +97,7 @@ const optionDefinitions = [
]
```

| # | Command line | .parse() output |
| # | argv input | commandLineArgs() output |
| --- | ------------ | ------------ |
| 1 | `-hcd` | `{ hot: true, courses: null, discount: true }` |
| 2 | `-hdc 3` | `{ hot: true, discount: true, courses: 3 }` |
Expand All @@ -116,7 +116,7 @@ const optionDefinitions = [

Note, examples 1 and 3 below demonstrate "greedy" parsing which can be disabled by using `lazyMultiple`.

| # | Command line | .parse() output |
| # | argv input | commandLineArgs() output |
| --- | ------------ | ------------ |
| 1 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
| 2 | `--files one.js --files two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
Expand All @@ -135,7 +135,7 @@ const optionDefinitions = [
]
```

| # | Command line | .parse() output |
| # | argv input | commandLineArgs() output |
| --- | ------------ | ------------ |
| 1 | `--files one.js --files two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
| 2 | `-vvv` | `{ verbose: [ true, true, true ] }` |
Expand All @@ -152,7 +152,7 @@ const optionDefinitions = [
]
```

| # | Command line | .parse() output |
| # | argv input | commandLineArgs() output |
| --- | ------------ | ------------ |
| 1 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
| 2 | `one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
Expand All @@ -171,7 +171,7 @@ const optionDefinitions = [
]
```

| # | Command line | .parse() output |
| # | argv input | commandLineArgs() output |
| --- | ------------ | ------------ |
| 1 | | `{ files: [ 'one.js' ], max: 3 }` |
| 2 | `--files two.js` | `{ files: [ 'two.js' ], max: 3 }` |
Expand All @@ -197,7 +197,7 @@ const optionDefinitions = [

<table>
<tr>
<th>#</th><th>Command Line</th><th>.parse() output</th>
<th>#</th><th>Command Line</th><th>commandLineArgs() output</th>
</tr>
<tr>
<td>1</td><td><code>--verbose</code></td><td><pre><code>
Expand Down
18 changes: 9 additions & 9 deletions lib/option-definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class OptionDefinition {
*
* Where a `type` property is not specified it will default to `String`.
*
* | # | Command line args | .parse() output |
* | # | argv input | commandLineArgs() output |
* | --- | -------------------- | ------------ |
* | 1 | `--file` | `{ file: null }` |
* | 2 | `--file lib.js` | `{ file: 'lib.js' }` |
Expand Down Expand Up @@ -63,13 +63,13 @@ class OptionDefinition {
* ])
* ```
*
* | # | Command line args| .parse() output |
* | # | argv input | commandLineArgs() output |
* | --- | ----------------- | ------------ |
* | 1 | `--file asdf.txt` | `{ file: { filename: 'asdf.txt', exists: false } }` |
*
* The `--depth` option expects a `Number`. If no value was set, you will receive `null`.
*
* | # | Command line args | .parse() output |
* | # | argv input | commandLineArgs() output |
* | --- | ----------------- | ------------ |
* | 2 | `--depth` | `{ depth: null }` |
* | 3 | `--depth 2` | `{ depth: 2 }` |
Expand All @@ -90,7 +90,7 @@ class OptionDefinition {
* ]
* ```
*
* | # | Command line | .parse() output |
* | # | argv input | commandLineArgs() output |
* | --- | ------------ | ------------ |
* | 1 | `-hcd` | `{ hot: true, courses: null, discount: true }` |
* | 2 | `-hdc 3` | `{ hot: true, discount: true, courses: 3 }` |
Expand All @@ -110,7 +110,7 @@ class OptionDefinition {
*
* Note, examples 1 and 3 below demonstrate "greedy" parsing which can be disabled by using `lazyMultiple`.
*
* | # | Command line | .parse() output |
* | # | argv input | commandLineArgs() output |
* | --- | ------------ | ------------ |
* | 1 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
* | 2 | `--files one.js --files two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
Expand All @@ -130,7 +130,7 @@ class OptionDefinition {
* ]
* ```
*
* | # | Command line | .parse() output |
* | # | argv input | commandLineArgs() output |
* | --- | ------------ | ------------ |
* | 1 | `--files one.js --files two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
* | 2 | `-vvv` | `{ verbose: [ true, true, true ] }` |
Expand All @@ -148,7 +148,7 @@ class OptionDefinition {
* ]
* ```
*
* | # | Command line | .parse() output |
* | # | argv input | commandLineArgs() output |
* | --- | ------------ | ------------ |
* | 1 | `--files one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
* | 2 | `one.js two.js` | `{ files: [ 'one.js', 'two.js' ] }` |
Expand All @@ -168,7 +168,7 @@ class OptionDefinition {
* ]
* ```
*
* | # | Command line | .parse() output |
* | # | argv input | commandLineArgs() output |
* | --- | ------------ | ------------ |
* | 1 | | `{ files: [ 'one.js' ], max: 3 }` |
* | 2 | `--files two.js` | `{ files: [ 'two.js' ], max: 3 }` |
Expand All @@ -195,7 +195,7 @@ class OptionDefinition {
*
*<table>
* <tr>
* <th>#</th><th>Command Line</th><th>.parse() output</th>
* <th>#</th><th>Command Line</th><th>commandLineArgs() output</th>
* </tr>
* <tr>
* <td>1</td><td><code>--verbose</code></td><td><pre><code>
Expand Down

0 comments on commit 9c07457

Please sign in to comment.