Skip to content

Commit 6de8a24

Browse files
committed
Align docs with current API behavior
1 parent bb1a865 commit 6de8a24

5 files changed

Lines changed: 23 additions & 15 deletions

File tree

site/docs/advanced.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ var app = new CommandApp("myexe")
9191
```
9292

9393
This adds two sub-commands:
94-
- `completion <shell>` — generates the shell completion script
94+
- `completion <shell>` (hidden) — generates the shell completion script
9595
- `__complete` (hidden) — handles completion requests from the shell
9696

97+
Both commands are hidden from default help output, but callable directly.
98+
9799
### Installing Completions
98100

99101
Generate and source the completion script for your shell:
@@ -348,9 +350,10 @@ dotnet run -c Release --project src/XenoAtom.CommandLine.Benchmarks
348350

349351
XenoAtom.CommandLine is fully compatible with NativeAOT publishing:
350352

351-
- No reflection usage
353+
- No runtime code generation, dynamic proxies, or runtime binding
352354
- All types are trimmer-safe
353355
- `EnumWrapper<T>` avoids runtime reflection for enum parsing
356+
- Built-in defaults use only lightweight assembly metadata lookups (for example command name/version discovery)
354357

355358
Publish with NativeAOT:
356359

site/docs/arguments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ var app = new CommandApp("myexe")
137137
Running `myexe --help`:
138138

139139
```
140-
Usage: myexe [options] <input> [<output>] [<extra>]...
140+
Usage: myexe [options] <input> [<output>] <extra>*
141141
142142
-h, -?, --help Show this message and exit
143143

site/docs/commands.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Available commands:
9191
Running `myexe commit --help`:
9292

9393
```
94-
Usage: myexe commit [options] [<files>]...
94+
Usage: myexe commit [options] <files>*
9595
9696
Options:
9797
-m, --message=MESSAGE Commit MESSAGE
@@ -306,12 +306,14 @@ If no version string is provided, it extracts the version from the assembly's in
306306

307307
Understanding the parsing flow helps debug complex scenarios:
308308

309-
1. Parse options (tokens starting with `-`, `--`, or `/`), applying option callbacks as values are consumed.
310-
2. If sub-commands exist and a token matches a sub-command name, dispatch to that sub-command.
311-
3. Parse positional arguments (`CommandArgument`) for the selected command.
309+
1. Parse options for the current command (tokens starting with `-`, `--`, or `/`), applying option callbacks as values are consumed.
310+
2. If help/version is requested for the current command, stop and render output.
311+
3. Apply environment-variable fallbacks for options not set on the command line.
312312
4. Run option constraint checks (mutually exclusive, requires).
313-
5. Invoke the command action and return its exit code.
314-
6. On error, the error is reported to `Error` and `RunAsync` returns `1`.
313+
5. If sub-commands exist and the next token matches an active sub-command, dispatch to that sub-command and repeat.
314+
6. Parse positional arguments (`CommandArgument`) for the resolved command.
315+
7. Invoke the command action and return its exit code.
316+
8. On error, the error is reported to `Error` and `RunAsync` returns `1`.
315317

316318
If the parser is currently expecting a value for an option, the next token is **always** consumed as that value — even if it looks like `--` or matches a sub-command name.
317319

site/docs/help-output.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ For rich colored and visual help output, install the optional `XenoAtom.CommandL
273273
dotnet add package XenoAtom.CommandLine.Terminal
274274
```
275275

276-
> **Note:** This package targets `net10.0` and depends on `XenoAtom.Terminal`.
276+
> **Note:** This package targets `net10.0` and depends on `XenoAtom.Terminal.UI` (which pulls `XenoAtom.Terminal` transitively).
277277
278278
### TerminalMarkupCommandOutput
279279

@@ -365,7 +365,7 @@ XenoAtom.CommandLine provides informative error messages by default:
365365

366366
```
367367
myexe: Unknown option: --unkown
368-
Did you mean '--unknown'?
368+
Did you mean: --unknown
369369
Use `myexe --help` for usage.
370370
```
371371

@@ -375,7 +375,7 @@ When an option exists but is inside an inactive `CommandGroup`:
375375

376376
```
377377
myexe: Unknown option: --special1
378-
Note: option '--special1' exists but is inactive in the current context.
378+
Note: `--special1` matches an option that is currently inactive in this context.
379379
Use `myexe --help` for usage.
380380
```
381381

site/docs/validation.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ var app = new CommandApp("myexe")
2828
If validation fails, a clear error message is shown:
2929

3030
```
31-
myexe: The value '99999' is not valid for option '--port'. The value must be between 1 and 65535.
31+
myexe: Invalid value for option `--port`: The value must be between 1 and 65535.
32+
Use `myexe --help` for usage.
3233
```
3334

3435
## Built-in Validators
@@ -129,7 +130,8 @@ app.AddMutuallyExclusive("json", "xml", "csv");
129130
If the user passes `--json --xml`, the error is:
130131

131132
```
132-
myexe: Options --json and --xml cannot be used together.
133+
myexe: Options `--json` and `--xml` cannot be used together.
134+
Use `myexe --help` for usage.
133135
```
134136

135137
### Requires Constraint
@@ -150,7 +152,8 @@ app.AddRequires("password", "user");
150152
If the user passes `--password secret` without `--user`, the error is:
151153

152154
```
153-
myexe: Option --password requires --user to also be specified.
155+
myexe: Option `--password` requires `--user` to also be specified.
156+
Use `myexe --help` for usage.
154157
```
155158

156159
### Combining Constraints

0 commit comments

Comments
 (0)