pub struct Surface {
pub binary: String,
pub mount: String,
pub about: String,
pub version: Option<String>,
pub arguments: Vec<SurfaceArgument>,
pub inherited_arguments: Vec<SurfaceArgument>,
pub commands: Vec<SurfaceCommand>,
pub usage_kdl: String,
pub mount_line: String,
pub notes: BTreeMap<String, String>,
}Expand description
Serializable operator-facing projection of one Clap command graph.
Fields§
§binary: StringExecutable name declared by the root Clap command.
mount: StringMise task name used for mounted invocations.
about: StringRoot command description.
version: Option<String>Root package version, when Clap declares one.
arguments: Vec<SurfaceArgument>Arguments and flags declared directly on the root, in Clap order.
inherited_arguments: Vec<SurfaceArgument>Ancestor global arguments, always empty for the root.
commands: Vec<SurfaceCommand>Root subcommands in Clap declaration order, including hidden commands.
usage_kdl: StringUsage KDL for the mounted task name.
mount_line: StringExact #USAGE mount line for a served mise task.
notes: BTreeMap<String, String>Consumer-owned operator notes keyed for skill or instruction templates.
Implementations§
Source§impl Surface
impl Surface
Sourcepub fn new<C: CommandFactory>(mount: impl Into<String>) -> Self
pub fn new<C: CommandFactory>(mount: impl Into<String>) -> Self
Extract an operator surface from a Clap
CommandFactory.
Sourcepub fn from_command(command: Command, mount: impl Into<String>) -> Self
pub fn from_command(command: Command, mount: impl Into<String>) -> Self
Extract an operator surface from a Clap command graph.
Sourcepub fn note(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn note(self, name: impl Into<String>, value: impl Into<String>) -> Self
Add consumer-owned prose for a template audience or section.
Sourcepub fn long_options_without_short(&self) -> Vec<(String, String)>
pub fn long_options_without_short(&self) -> Vec<(String, String)>
Long flags that have no short, as (command path, long name).
The root path is empty. Inherited globals are not repeated on children.
Hidden flags are included so a long-only option cannot hide from the
check. FormatLong and
ColorLong leave --format / --color
without shorts on purpose; pass those names to Self::require_shorts.
Sourcepub fn require_shorts<'a>(
&self,
allow: impl IntoIterator<Item = &'a str>,
) -> Result<(), String>
pub fn require_shorts<'a>( &self, allow: impl IntoIterator<Item = &'a str>, ) -> Result<(), String>
Fail when a long option has no operator-visible short, except tokens in
allow.
A root allowance is the displayed long option (--format). A nested
allowance includes its command path (status --archived). Chassis
mixins that deliberately leave a letter for the consumer (--format
for -f/--file, --color for -c) belong there.
Trait Implementations§
impl Eq for Surface
impl StructuralPartialEq for Surface
Auto Trait Implementations§
impl Freeze for Surface
impl RefUnwindSafe for Surface
impl Send for Surface
impl Sync for Surface
impl Unpin for Surface
impl UnsafeUnpin for Surface
impl UnwindSafe for Surface
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more