Skip to main content

CommandExtra

Struct CommandExtra 

Source
pub struct CommandExtra<'a> {
Show 28 fields pub deprecated: Option<&'a str>, pub deprecated_warn_at: Option<&'a str>, pub deprecated_remove_at: Option<&'a str>, pub hidden_aliases: &'a [&'a str], pub help_heading: Option<&'a str>, pub surface: Option<&'a str>, pub available_if: &'a [&'a str], pub display_order: Option<u32>, pub effect: Option<Effect>, pub mount: Option<&'a str>, pub restart_token: Option<&'a str>, pub clause: Option<&'a ClauseMeta<'a>>, pub subcommand_required: bool, pub subcommand_help_heading: Option<&'a str>, pub subcommand_value_name: Option<&'a str>, pub next_line_help: bool, pub flatten_help: bool, pub term_width: Option<u16>, pub max_term_width: Option<u16>, pub before_help: Option<&'a str>, pub before_long_help: Option<&'a str>, pub after_help: Option<&'a str>, pub after_long_help: Option<&'a str>, pub examples: &'a [Example<'a>], pub headings: &'a [HeadingMeta<'a>], pub outputs: &'a [OutputMeta<'a>], pub select: Option<&'a str>, pub exit_codes: &'a [ExitCodeMeta<'a>],
}
Expand description

The rarely declared part of a CommandMeta, behind one pointer.

A typical command has an about line, its flags and arguments, and nothing here. Holding these inline made every command’s metadata, including each flattened Args type’s, several hundred bytes of mostly empty fields in the binary.

Fields§

§deprecated: Option<&'a str>

Why this command is deprecated, plus optional release milestones.

§deprecated_warn_at: Option<&'a str>§deprecated_remove_at: Option<&'a str>§hidden_aliases: &'a [&'a str]

Aliases that work but are not shown in help or completions. Everything in cmd.aliases and not here is visible.

§help_heading: Option<&'a str>

Help section this command appears under in its parent’s command list.

§surface: Option<&'a str>

Named audience or compatibility surface this command belongs to.

§available_if: &'a [&'a str]

Descriptive availability conditions; they do not affect parsing.

§display_order: Option<u32>

Explicit placement within the parent’s command section.

Positions, bounds and widths in the metadata are u32 or u16 rather than usize, which halves them in a table emitted for every command, flag and argument. A derive saturates a larger declared value rather than wrapping it.

§effect: Option<Effect>

What running this does to the world, for a caller deciding whether to confirm first. clap cannot express this, which is why mise keeps a 330-entry table to bolt it on afterwards.

§mount: Option<&'a str>

A command to run at parse time to discover further subcommands.

Only meaningful on a subcommand. The spec accepts mount inside a cmd block and nowhere else, so setting this on the root is a mistake that Spec::to_kdl catches in debug builds.

§restart_token: Option<&'a str>

A token that starts a fresh invocation of this command, such as mise’s :::.

§clause: Option<&'a ClauseMeta<'a>>

Metadata for a repeatable positional clause.

Behind a reference for the reason Command::clause is.

§subcommand_required: bool

Whether this command cannot be run on its own: naming it and stopping is an error, and one of its subcommands has to follow.

Cold metadata rather than a parse table, because it is not how a word binds — the derive already refuses the invocation from the type, a bare T subcommand field against an Option<T>. It is here so the emitted spec can say it, since everything reading that spec — help, docs, completions — otherwise describes a command as runnable when it is not.

§subcommand_help_heading: Option<&'a str>

Heading for the list of this command’s subcommands.

§subcommand_value_name: Option<&'a str>

Placeholder used for a subcommand in the usage synopsis.

§next_line_help: bool

Put each argument, flag, and subcommand description on the following line.

§flatten_help: bool

Expand each visible subcommand’s summary and arguments into this command’s help page.

§term_width: Option<u16>

Fixed help width. Zero disables wrapping.

§max_term_width: Option<u16>

Maximum detected terminal width when term_width is unset. Zero disables the cap.

§before_help: Option<&'a str>

Text printed above the usage line, and below everything else.

The spec’s before_help/after_help and their long forms. mise puts an Examples section in after_long_help on 115 commands, which is where the reference renders it from — so a help page without these is missing the part a reader came for.

§before_long_help: Option<&'a str>§after_help: Option<&'a str>§after_long_help: Option<&'a str>§examples: &'a [Example<'a>]§headings: &'a [HeadingMeta<'a>]

Prose for this command’s help sections, by heading title.

§outputs: &'a [OutputMeta<'a>]

What this command writes, and how a consumer should read it.

§select: Option<&'a str>

The flag whose value picks among Self::outputs, e.g. --format.

§exit_codes: &'a [ExitCodeMeta<'a>]

What this command’s exit statuses mean.

Implementations§

Source§

impl CommandExtra<'_>

Source

pub const EMPTY: CommandExtra<'static>

Nothing declared, for struct update syntax.

Trait Implementations§

Source§

impl<'a> Clone for CommandExtra<'a>

Source§

fn clone(&self) -> CommandExtra<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for CommandExtra<'a>

Source§

impl<'a> Debug for CommandExtra<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for CommandExtra<'a>

§

impl<'a> RefUnwindSafe for CommandExtra<'a>

§

impl<'a> Send for CommandExtra<'a>

§

impl<'a> Sync for CommandExtra<'a>

§

impl<'a> Unpin for CommandExtra<'a>

§

impl<'a> UnsafeUnpin for CommandExtra<'a>

§

impl<'a> UnwindSafe for CommandExtra<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.