Terminology and links (#1361)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* Add separate terminology and cross-reference new documentation * Reword link to extra documentation. Add Terminolgy to README.
authored by John Gee · committed by GitHub · parent 9236449 · Browse files · 3 files·+27 added−22 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+27 added−22 removed
- other:+27 added−22 removed
Provenance
- Commit
e56fba2- Tree
d9423eb- Author
John Gee <john@ruru.gen.nz>- Committer
GitHub <noreply@github.com>- Parent
9236449
3 files changed+27 added−22 removed
modified:docs/options-taking-varying-arguments.md+3 added-22 removed
8 unmodified lines9 - [Alternative: Put options last](#alternative-put-options-last)10 - [Alternative: Use options instead of command-arguments](#alternative-use-options-instead-of-command-arguments)11 - [Combining short options, and options taking arguments](#combining-short-options-and-options-taking-arguments)12 - [Combining short options as if boolean](#combining-short-options-as-if-boolean)13- - [Terminology](#terminology)13 14 Certain options take a varying number of arguments:15 16 ```js4 unmodified lines21 ```22 23 This page uses examples with options taking 0 or 1 arguments, but the discussions also apply to variadic options taking more arguments.24 25+For information about terms used in this document see: [terminology](./terminology.md)26+27 ## Parsing ambiguity28 29 There is a potential downside to be aware of. If a command has both30 command-arguments and options with varying option-arguments, this introduces a parsing ambiguity which may affect the user of your program.109 unmodified lines140 $ cook -i -t scrambled141 technique: scrambled142 ingredient: cheese143 ```144+145 ## Combining short options, and options taking arguments146 147 Multiple boolean short options can be combined after a single `-`, like `ls -al`. You can also include just148 a single short option which might take a value, as any following characters will49 unmodified lines198 ```js199 .combineFlagAndOptionalValue(true) // `-v45` is treated like `--vegan=45`, this is the default behaviour200 .combineFlagAndOptionalValue(false) // `-vl` is treated like `-v -l`201 ```200-201-## Terminology202-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-```sh217-my-utility command -o --option option-argument command-argument-1 command-argument-2218-```219-220-In other references options are sometimes called flags, and command-arguments are sometimes called positional arguments or operands.added:docs/terminology.md+18 added
123456789101112131415161718# Terminology
The command line arguments are made up of options, option-arguments, commands, and command-arguments.
| Term | Explanation || --- | --- || option | an argument which is a `-` followed by a character, or `--` followed by a word (or hyphenated words), like `-s` or `--short` || option-argument| some options can take an argument || command | a program or command can have subcommands || command-argument | argument for the command (and not an option or option-argument) |
For example:
```shmy-utility command -o --option option-argument command-argument-1 command-argument-2```
In other references options are sometimes called flags, and command-arguments are sometimes called positional arguments or operands.modified:Readme.md+6 added
44 unmodified lines45 - [Examples](#examples)46 - [Support](#support)47 - [Commander for enterprise](#commander-for-enterprise)48 49+For information about terms used in this document see: [terminology](./docs/terminology.md)50+51 ## Installation52 53 ```bash54 npm install commander148 unmodified lines203 $ pizza-options --cheese mozzarella204 add cheese type mozzarella205 ```206 207+For information about possible ambiguous cases, see [options taking varying arguments](./docs/options-taking-varying-arguments.md).208+209 ### Custom option processing210 211 You may specify a function to do custom processing of option values. The callback function receives two parameters, the user specified value and the212 previous value for the option. It returns the new value for the option.101 unmodified lines314 Options: { number: [ '1', '2', '3' ], letter: true }315 Remaining arguments: [ 'operand' ]316 ```317 318+For information about possible ambiguous cases, see [options taking varying arguments](./docs/options-taking-varying-arguments.md).319+320 ### Version option321 322 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.323 464 unmodified lines