Skip to main content

Crate ashlar_cli

Crate ashlar_cli 

Source
Expand description

The standard verbs of an app’s command-line tool, over its command registry (<tool> is the name given to Cli::new, the command as it is installed):

<tool> commands [--json] [--query Q]          list commands
<tool> describe <id>                          one command in full (parameter schema)
<tool> docs [category|path.md] [--query Q]   the documentation: categories, one category, one file
<tool> exec <id> [json|-]                     run one command
<tool> run <file.jsonl|-> [--keep-going]    run {"command","params"} lines
<tool> mcp [--isolate] [--per-command]        MCP server on stdio
<tool> serve                                  control protocol on stdio (a worker for `mcp --isolate`)
<tool> version [--json]

commands, describe, exec, run and mcp take --connect PORT to drive the running app instead of a headless session. Replies are one line, {"ok":true,"result":…} or {"ok":false,"error":"…"}; exit codes are 0 (ok), 1 (the command failed), 2 (usage). Apps add their own verbs with Cli::verb.

fn main() -> std::process::ExitCode {
    ashlar_cli::Cli::new("notes", env!("CARGO_PKG_VERSION"), session).run()
}

Structs§

Args
The arguments after the verb.
Cli
An app’s CLI: standard verbs plus its own.
Io
The streams a verb uses (real stdio in Cli::run, buffers in tests). Send, so mcp can read and write on their own threads.

Enums§

Exit
How a verb ended.