pub struct Spec<'a> {Show 17 fields
pub name: &'a str,
pub bin: Option<&'a str>,
pub version: Option<&'a str>,
pub long_version: Option<&'a str>,
pub author: Option<&'a str>,
pub license: Option<&'a str>,
pub repository: Option<&'a str>,
pub source_code_link_template: Option<&'a str>,
pub min_usage_version: Option<&'a str>,
pub about: Option<&'a str>,
pub long_about: Option<&'a str>,
pub usage: Option<&'a str>,
pub help_template: Option<&'a str>,
pub default_subcommand: Option<&'a str>,
pub multicall: bool,
pub views: &'a [ViewMeta<'a>],
pub root: &'a CommandMeta<'a>,
}Expand description
A whole CLI: the root command plus what describes the program itself.
Fields§
§name: &'a strThe program’s name.
bin: Option<&'a str>The binary as invoked, when it differs from name.
version: Option<&'a str>§long_version: Option<&'a str>Extended version text used by --version; -V falls back to version.
Package authorship text for generated references.
license: Option<&'a str>SPDX expression or other license label for generated references.
repository: Option<&'a str>Source repository URL for generated references and integrations.
source_code_link_template: Option<&'a str>A tera template turning a command path into a link to the code implementing it.
Rendered with path bound to the command’s words joined by /, so a docs
generator can put a “view source” link on every command page. Distinct from
Self::repository, which is the plain project URL: a deep link with a
{{path}} placeholder cannot be turned back into one without knowing a
particular forge’s URL layout.
min_usage_version: Option<&'a str>The oldest usage that can read this spec, when the CLI says.
Written first, before anything a usage too old to understand would choke on — which is
the whole point of it, and why it is declared rather than worked out here: it is the
CLI’s claim about which consumers it means to keep working.
about: Option<&'a str>§long_about: Option<&'a str>§usage: Option<&'a str>An exact usage synopsis, including the Usage: prefix, when the generated
shape needs alternatives that cannot be inferred from one command grammar.
help_template: Option<&'a str>How every page in this CLI is laid out, as named sections.
A template names the pre-rendered sections and may reorder, omit, wrap or colour them.
See crate::help::SECTIONS for what each one covers and
crate::help::unsupported_section for the rule an author’s template is held to.
default_subcommand: Option<&'a str>Which command the root falls back to when a word matches no subcommand.
mise uses this so mise foo completes as mise run foo.
multicall: boolWhether argv[0]’s basename selects a subcommand (busybox-style applets).
clap’s multicall. The dispatcher names (name / bin) are skipped; any
other basename is parsed as the first word. Path components and a trailing
.exe are stripped. The parser itself does not see argv[0]; crate::multicall_applet
is what a process entry applies before calling it.
views: &'a [ViewMeta<'a>]Spec-declared executable views promoted from commands below the root.
root: &'a CommandMeta<'a>The root command, and the home of everything a spec declares at its top level.
A KDL spec has one place for surrounding text and examples — the top level — and the
reference reads what is written there as the root’s and as the default for every
other page. So they live here, on the root’s metadata, rather than in a second set of
fields on the spec: two homes for one declaration is two answers to one question, and
to_kdl and the renderer picked differently.