pub struct SpecCommandBuilder { /* private fields */ }Expand description
Builder for SpecCommand
Implementations§
Source§impl SpecCommandBuilder
impl SpecCommandBuilder
Sourcepub fn surface(self, surface: impl Into<String>) -> SpecCommandBuilder
pub fn surface(self, surface: impl Into<String>) -> SpecCommandBuilder
Label the audience or compatibility surface this command belongs to.
Sourcepub fn available_if(self, condition: impl Into<String>) -> SpecCommandBuilder
pub fn available_if(self, condition: impl Into<String>) -> SpecCommandBuilder
Add a descriptive availability condition.
Sourcepub fn new() -> SpecCommandBuilder
pub fn new() -> SpecCommandBuilder
Create a new SpecCommandBuilder
Sourcepub fn name(self, name: impl Into<String>) -> SpecCommandBuilder
pub fn name(self, name: impl Into<String>) -> SpecCommandBuilder
Set the command name
Sourcepub fn alias(self, alias: impl Into<String>) -> SpecCommandBuilder
pub fn alias(self, alias: impl Into<String>) -> SpecCommandBuilder
Add an alias (can be called multiple times)
Sourcepub fn aliases<I, S>(self, aliases: I) -> SpecCommandBuilder
pub fn aliases<I, S>(self, aliases: I) -> SpecCommandBuilder
Add multiple aliases at once
Add a hidden alias (can be called multiple times)
Add multiple hidden aliases at once
Sourcepub fn flag(self, flag: SpecFlag) -> SpecCommandBuilder
pub fn flag(self, flag: SpecFlag) -> SpecCommandBuilder
Add a flag to the command
Sourcepub fn flags(
self,
flags: impl IntoIterator<Item = SpecFlag>,
) -> SpecCommandBuilder
pub fn flags( self, flags: impl IntoIterator<Item = SpecFlag>, ) -> SpecCommandBuilder
Add multiple flags at once
Sourcepub fn arg(self, arg: SpecArg) -> SpecCommandBuilder
pub fn arg(self, arg: SpecArg) -> SpecCommandBuilder
Add an argument to the command
Sourcepub fn args(self, args: impl IntoIterator<Item = SpecArg>) -> SpecCommandBuilder
pub fn args(self, args: impl IntoIterator<Item = SpecArg>) -> SpecCommandBuilder
Add multiple arguments at once
Sourcepub fn help(self, text: impl Into<String>) -> SpecCommandBuilder
pub fn help(self, text: impl Into<String>) -> SpecCommandBuilder
Set help text
Sourcepub fn help_long(self, text: impl Into<String>) -> SpecCommandBuilder
pub fn help_long(self, text: impl Into<String>) -> SpecCommandBuilder
Set long help text
Sourcepub fn help_md(self, text: impl Into<String>) -> SpecCommandBuilder
pub fn help_md(self, text: impl Into<String>) -> SpecCommandBuilder
Set markdown help text
Sourcepub fn hide(self, is_hidden: bool) -> SpecCommandBuilder
pub fn hide(self, is_hidden: bool) -> SpecCommandBuilder
Set as hidden
Sourcepub fn subcommand_required(self, required: bool) -> SpecCommandBuilder
pub fn subcommand_required(self, required: bool) -> SpecCommandBuilder
Set subcommand required
Sourcepub fn subcommand_help_heading(
self,
heading: impl Into<String>,
) -> SpecCommandBuilder
pub fn subcommand_help_heading( self, heading: impl Into<String>, ) -> SpecCommandBuilder
Set the heading for this command’s subcommand list.
Sourcepub fn subcommand_value_name(
self,
name: impl Into<String>,
) -> SpecCommandBuilder
pub fn subcommand_value_name( self, name: impl Into<String>, ) -> SpecCommandBuilder
Set the synopsis placeholder for a subcommand.
Sourcepub fn term_width(self, width: usize) -> SpecCommandBuilder
pub fn term_width(self, width: usize) -> SpecCommandBuilder
Set a fixed help width. Zero disables wrapping.
Sourcepub fn max_term_width(self, width: usize) -> SpecCommandBuilder
pub fn max_term_width(self, width: usize) -> SpecCommandBuilder
Cap detected terminal width when no fixed width is set. Zero disables the cap.
Sourcepub fn external_subcommand(self, enabled: bool) -> SpecCommandBuilder
pub fn external_subcommand(self, enabled: bool) -> SpecCommandBuilder
Forward an unmatched word as an external command plus the rest of argv
Sourcepub fn disable_help_flag(self, disabled: bool) -> SpecCommandBuilder
pub fn disable_help_flag(self, disabled: bool) -> SpecCommandBuilder
Enable or disable the synthesized --help and -h flags.
Sourcepub fn disable_help_subcommand(self, disabled: bool) -> SpecCommandBuilder
pub fn disable_help_subcommand(self, disabled: bool) -> SpecCommandBuilder
Enable or disable the synthesized help subcommand route.
Sourcepub fn disable_version_flag(self, disabled: bool) -> SpecCommandBuilder
pub fn disable_version_flag(self, disabled: bool) -> SpecCommandBuilder
Enable or disable the synthesized --version and -V flags.
Sourcepub fn args_override_self(self, enabled: bool) -> SpecCommandBuilder
pub fn args_override_self(self, enabled: bool) -> SpecCommandBuilder
Set whether a later scalar flag occurrence replaces an earlier one.
Enabled by default. Set false to reject duplicate scalar flags.
Sourcepub fn subcommand_negates_reqs(self, enabled: bool) -> SpecCommandBuilder
pub fn subcommand_negates_reqs(self, enabled: bool) -> SpecCommandBuilder
Set whether selecting a subcommand suppresses this command’s requirements.
Sourcepub fn args_conflicts_with_subcommands(
self,
enabled: bool,
) -> SpecCommandBuilder
pub fn args_conflicts_with_subcommands( self, enabled: bool, ) -> SpecCommandBuilder
Set whether arguments on this command exclude a later subcommand.
pub fn subcommand_precedence_over_arg(self, enabled: bool) -> SpecCommandBuilder
pub fn allow_missing_positional(self, enabled: bool) -> SpecCommandBuilder
Sourcepub fn effect(self, effect: SpecCommandEffect) -> SpecCommandBuilder
pub fn effect(self, effect: SpecCommandEffect) -> SpecCommandBuilder
Set what running this command does to the world
Sourcepub fn deprecated(self, msg: impl Into<String>) -> SpecCommandBuilder
pub fn deprecated(self, msg: impl Into<String>) -> SpecCommandBuilder
Set deprecated message
pub fn deprecated_warn_at( self, version: impl Into<String>, ) -> SpecCommandBuilder
pub fn deprecated_remove_at( self, version: impl Into<String>, ) -> SpecCommandBuilder
Sourcepub fn restart_token(self, token: impl Into<String>) -> SpecCommandBuilder
pub fn restart_token(self, token: impl Into<String>) -> SpecCommandBuilder
Set restart token for resetting argument parsing
e.g., mise run lint ::: test ::: check with restart_token=“:::”
Sourcepub fn subcommand(self, cmd: SpecCommand) -> SpecCommandBuilder
pub fn subcommand(self, cmd: SpecCommand) -> SpecCommandBuilder
Add a subcommand (can be called multiple times)
Sourcepub fn subcommands(
self,
cmds: impl IntoIterator<Item = SpecCommand>,
) -> SpecCommandBuilder
pub fn subcommands( self, cmds: impl IntoIterator<Item = SpecCommand>, ) -> SpecCommandBuilder
Add multiple subcommands at once
Sourcepub fn before_help(self, text: impl Into<String>) -> SpecCommandBuilder
pub fn before_help(self, text: impl Into<String>) -> SpecCommandBuilder
Set before_help text (displayed before the help message)
Sourcepub fn before_help_long(self, text: impl Into<String>) -> SpecCommandBuilder
pub fn before_help_long(self, text: impl Into<String>) -> SpecCommandBuilder
Set before_help_long text
Sourcepub fn before_help_md(self, text: impl Into<String>) -> SpecCommandBuilder
pub fn before_help_md(self, text: impl Into<String>) -> SpecCommandBuilder
Set before_help markdown text
Sourcepub fn after_help(self, text: impl Into<String>) -> SpecCommandBuilder
pub fn after_help(self, text: impl Into<String>) -> SpecCommandBuilder
Set after_help text (displayed after the help message)
Sourcepub fn after_help_long(self, text: impl Into<String>) -> SpecCommandBuilder
pub fn after_help_long(self, text: impl Into<String>) -> SpecCommandBuilder
Set after_help_long text
Sourcepub fn after_help_md(self, text: impl Into<String>) -> SpecCommandBuilder
pub fn after_help_md(self, text: impl Into<String>) -> SpecCommandBuilder
Set after_help markdown text
Sourcepub fn example(self, code: impl Into<String>) -> SpecCommandBuilder
pub fn example(self, code: impl Into<String>) -> SpecCommandBuilder
Add an example (can be called multiple times)
Sourcepub fn example_with_help(
self,
code: impl Into<String>,
header: impl Into<String>,
help: impl Into<String>,
) -> SpecCommandBuilder
pub fn example_with_help( self, code: impl Into<String>, header: impl Into<String>, help: impl Into<String>, ) -> SpecCommandBuilder
Add an example with header and help text
Sourcepub fn build(self) -> SpecCommand
pub fn build(self) -> SpecCommand
Build the final SpecCommand
Trait Implementations§
Source§impl Clone for SpecCommandBuilder
impl Clone for SpecCommandBuilder
Source§fn clone(&self) -> SpecCommandBuilder
fn clone(&self) -> SpecCommandBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SpecCommandBuilder
impl Debug for SpecCommandBuilder
Source§impl Default for SpecCommandBuilder
impl Default for SpecCommandBuilder
Source§fn default() -> SpecCommandBuilder
fn default() -> SpecCommandBuilder
Auto Trait Implementations§
impl !Freeze for SpecCommandBuilder
impl RefUnwindSafe for SpecCommandBuilder
impl Send for SpecCommandBuilder
impl Sync for SpecCommandBuilder
impl Unpin for SpecCommandBuilder
impl UnsafeUnpin for SpecCommandBuilder
impl UnwindSafe for SpecCommandBuilder
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<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