You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An option is composed of a prototype that defines the option syntax (e.g. `"o|output="`).
100
100
101
+
### Quick Reference
102
+
103
+
The prototype is what you pass to `Add(...)` (or use in the collection initializer). It controls how the option can be written on the command line.
104
+
105
+
| Prototype (declaration) | What it declares | How it’s passed | Notes |
106
+
|---|---|---|---|
107
+
| `"v|verbose"` | Flag / boolean option |`-v`, `--verbose`, `/v`| Use `-v+` / `-v-` to explicitly enable/disable when parsed as a bool option. |
108
+
| `"n|name="` | Required value |`--name John`, `--name=John`, `-nJohn`, `-n:John`, `/name:John`| If you omit `:`/`=`, the next token is consumed as the value (e.g. `--name John`). |
109
+
|`"o:"`| Optional value |`-o`, `-oVALUE`, `-o:VALUE`, `--o=VALUE`| Optional values must be inline; `-o VALUE` does **not** attach `VALUE` to `-o`. |
110
+
|`"D:"` with 2 values | Key/value pair (2 values) |`-DKEY`, `-DKEY=VALUE`, `-DKEY:VALUE`| Typically used for “macro” options. With `:` (optional), the second value can be omitted. |
111
+
|`"P={->}"` with 2 values | Key/value pair with custom separator |`-PKEY->VALUE`| Custom separator is declared between `{...}`. |
112
+
|`"i"` in a bundle | Bundled short options |`-abc`, `-txc`| Only works with `-` and single-letter options; at most one option in the bundle can take a value. |
113
+
|`--`| Stop option parsing |`myexe -- --not-an-option -x /mnt/home`| Everything after `--` is treated as positional arguments. |
114
+
115
+
Value placeholders in descriptions:
116
+
- For `MaxValueCount == 1`, `"{NAME}"` sets the displayed value name.
117
+
- For multiple values, use `"{0:KEY} {1:VALUE}"` to name each value.
-`#` comments (when `#` is the first non-whitespace character on a line, or after a completed token)
554
591
- Basic `\` escaping on non-Windows platforms (e.g. `c\ d` -> `c d`), while keeping `\` as a literal character on Windows (so paths like `C:\Temp\file.txt` are preserved).
`CommandGroup` are a special kind of nodes that can contain any other nodes (commands, options, text, actions...). They are used to group commands/options together, but more importantly, they can be used to declare when they are active based on a function callback.
0 commit comments