Skip to content

Commit e56fba2

Browse files
authored
Terminology and links (#1361)
* Add separate terminology and cross-reference new documentation * Reword link to extra documentation. Add Terminolgy to README.
1 parent 9236449 commit e56fba2

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

Readme.md

+6
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md)
4646
- [Support](#support)
4747
- [Commander for enterprise](#commander-for-enterprise)
4848

49+
For information about terms used in this document see: [terminology](./docs/terminology.md)
50+
4951
## Installation
5052

5153
```bash
@@ -202,6 +204,8 @@ $ pizza-options --cheese mozzarella
202204
add cheese type mozzarella
203205
```
204206
207+
For information about possible ambiguous cases, see [options taking varying arguments](./docs/options-taking-varying-arguments.md).
208+
205209
### Custom option processing
206210
207211
You may specify a function to do custom processing of option values. The callback function receives two parameters, the user specified value and the
@@ -311,6 +315,8 @@ Options: { number: [ '1', '2', '3' ], letter: true }
311315
Remaining arguments: [ 'operand' ]
312316
```
313317
318+
For information about possible ambiguous cases, see [options taking varying arguments](./docs/options-taking-varying-arguments.md).
319+
314320
### Version option
315321
316322
The optional `version` method adds handling for displaying the command version. The default option flags are `-V` and `--version`, and when present the command prints the version number and exits.

docs/options-taking-varying-arguments.md

+3-22
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ and subtle issues in depth.
1010
- [Alternative: Use options instead of command-arguments](#alternative-use-options-instead-of-command-arguments)
1111
- [Combining short options, and options taking arguments](#combining-short-options-and-options-taking-arguments)
1212
- [Combining short options as if boolean](#combining-short-options-as-if-boolean)
13-
- [Terminology](#terminology)
1413

1514
Certain options take a varying number of arguments:
1615

@@ -23,6 +22,8 @@ program
2322

2423
This page uses examples with options taking 0 or 1 arguments, but the discussions also apply to variadic options taking more arguments.
2524

25+
For information about terms used in this document see: [terminology](./terminology.md)
26+
2627
## Parsing ambiguity
2728

2829
There is a potential downside to be aware of. If a command has both
@@ -140,6 +141,7 @@ $ cook -i -t scrambled
140141
technique: scrambled
141142
ingredient: cheese
142143
```
144+
143145
## Combining short options, and options taking arguments
144146

145147
Multiple boolean short options can be combined after a single `-`, like `ls -al`. You can also include just
@@ -197,24 +199,3 @@ To modify the parsing of options taking an optional value:
197199
.combineFlagAndOptionalValue(true) // `-v45` is treated like `--vegan=45`, this is the default behaviour
198200
.combineFlagAndOptionalValue(false) // `-vl` is treated like `-v -l`
199201
```
200-
201-
## Terminology
202-
203-
_Work in progress: this section may move to the main README, or a page of its own._
204-
205-
The command line arguments are made up of options, option-arguments, commands, and command-arguments.
206-
207-
| Term | Explanation |
208-
| --- | --- |
209-
| option | an argument which is a `-` followed by a character, or `--` followed by a word (or hyphenated words), like `-s` or `--short` |
210-
| option-argument| some options can take an argument |
211-
| command | a program or command can have subcommands |
212-
| command-argument | argument for the command (and not an option or option-argument) |
213-
214-
For example:
215-
216-
```sh
217-
my-utility command -o --option option-argument command-argument-1 command-argument-2
218-
```
219-
220-
In other references options are sometimes called flags, and command-arguments are sometimes called positional arguments or operands.

docs/terminology.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Terminology
2+
3+
The command line arguments are made up of options, option-arguments, commands, and command-arguments.
4+
5+
| Term | Explanation |
6+
| --- | --- |
7+
| option | an argument which is a `-` followed by a character, or `--` followed by a word (or hyphenated words), like `-s` or `--short` |
8+
| option-argument| some options can take an argument |
9+
| command | a program or command can have subcommands |
10+
| command-argument | argument for the command (and not an option or option-argument) |
11+
12+
For example:
13+
14+
```sh
15+
my-utility command -o --option option-argument command-argument-1 command-argument-2
16+
```
17+
18+
In other references options are sometimes called flags, and command-arguments are sometimes called positional arguments or operands.

0 commit comments

Comments
 (0)