CLI Mode
When you pass arguments to your app, Repl dispatches the command and exits — standard CLI behavior.
Invocation
Section titled “Invocation”myapp <route> [arguments] [options]Examples:
myapp client listmyapp client 42 showmyapp client 42 show --jsonOutput formats
Section titled “Output formats”Every command supports output format flags out of the box:
| Flag | Output |
|---|---|
| (none) | Human-readable text / table |
--json | JSON |
--xml | XML |
--yaml | YAML |
--markdown | Markdown table |
$ myapp contacts list --json[ { "id": 1, "name": "Alice" }, { "id": 2, "name": "Bob" }]Help and discovery
Section titled “Help and discovery”--help is built in at every level:
$ myapp --helpCommands: client report
$ myapp client --helpCommands: client list client {id} show client {id} removeShell completion
Section titled “Shell completion”Register Repl’s completion scripts to get tab completion in your shell:
# Auto-detect current shellmyapp completion install
# Explicit shellmyapp completion install --shell bashmyapp completion install --shell powershellmyapp completion install --shell zshmyapp completion install --shell fishmyapp completion install --shell nu # NushellThis writes a managed block to the shell’s profile file. Tab completion then works for all routes, context segments, and option names.
Other commands:
myapp completion status # show current installation statusmyapp completion uninstall # remove the managed blockmyapp completion detect-shell # show which shell was detectedThe completion bridge (completion __complete) is hidden from --help — it is a protocol command used by the shell scripts.
Automatic installation — configure how completion is offered at startup:
SetupMode | Behavior |
|---|---|
Manual (default) | User runs install explicitly |
Prompt | Offers installation once on the first interactive startup |
Auto | Installs automatically when a supported shell is detected |
app.Options(o =>{ o.ShellCompletion.SetupMode = CompletionSetupMode.Prompt;});Response files
Section titled “Response files”Any argument prefixed with @ is a response file:
myapp @deploy.rspdeploy.rsp:
deploy--environmentproduction--regionus-east-1Tokens are read one per line. Useful for long or repeatable invocations, and for passing arguments in CI without quoting issues. Response files are not recursive.
Machine-readable help
Section titled “Machine-readable help”Add --help --json to get a structured help payload — useful for agents and tooling:
$ myapp client --help --json{ "name": "client", "commands": [ { "route": "list", "description": "..." }, { "route": "{id:int} show", "description": "..." } ]}Exit codes
Section titled “Exit codes”| Condition | Exit code |
|---|---|
| Success | 0 |
| All named errors — command not found, validation failure, cancellation, unhandled exception | 1 |
| Custom (explicit) | any N — use Results.Exit(N) in a handler to return an arbitrary code |
All error conditions produce exit code 1 by default. To signal a specific failure mode to callers or scripts, return Results.Exit(N) from your handler with the code that makes sense for your application.