pub struct CliSpec {
pub schema: String,
pub name: String,
pub version: String,
pub display_name: Option<String>,
pub build: Option<String>,
pub about: Option<String>,
pub lifecycle_output: OutputSpec,
pub exit_codes: Vec<ExitCodeSpec>,
pub commands: Vec<CommandSpec>,
}Expand description
Serializable version-one closed-world CLI registry.
Fields§
§schema: String§name: String§version: String§display_name: Option<String>Human-facing product name, distinct from the binary identity in name.
build: Option<String>Opaque build identifier (a git SHA, for example). The core only carries it; what it means is the host’s business.
about: Option<String>§lifecycle_output: OutputSpec§exit_codes: Vec<ExitCodeSpec>Exit codes this CLI returns beyond the 0/1/2 AFDATA defines, rendered into the reference’s exit-code table. Without this the published reference documents only AFDATA’s three, so a tool that also returns, say, a partial-success code ships a document that contradicts its own binary — on exactly the code a caller needs to branch on.
commands: Vec<CommandSpec>Implementations§
Source§impl CliSpec
impl CliSpec
Sourcepub fn new(name: impl Into<String>, version: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, version: impl Into<String>) -> Self
Start a cli-spec-v1 registry.
pub fn about(self, about: impl Into<String>) -> Self
pub fn display_name(self, display_name: impl Into<String>) -> Self
Sourcepub fn build_id(self, build: impl Into<String>) -> Self
pub fn build_id(self, build: impl Into<String>) -> Self
Record an opaque build identifier. Named build_id because build()
already compiles the registry.
pub fn lifecycle_output(self, output: OutputSpec) -> Self
Sourcepub fn exit_code(self, code: u8, meaning: impl Into<String>) -> Self
pub fn exit_code(self, code: u8, meaning: impl Into<String>) -> Self
Declare an exit code this CLI returns beyond AFDATA’s 0/1/2, so the rendered reference documents what the binary actually does.
pub fn command(self, command: CommandSpec) -> Self
Sourcepub fn build(self) -> Result<BuiltCliSpec, CliSpecError>
pub fn build(self) -> Result<BuiltCliSpec, CliSpecError>
Validate and compile the registry.