pub struct SpecCommandBuilder { /* private fields */ }Expand description
Builder for SpecCommand
Implementations§
Source§impl SpecCommandBuilder
impl SpecCommandBuilder
Sourcepub fn alias(self, alias: impl Into<String>) -> Self
pub fn alias(self, alias: impl Into<String>) -> Self
Add an alias (can be called multiple times)
Add a hidden alias (can be called multiple times)
Add multiple hidden aliases at once
Sourcepub fn flags(self, flags: impl IntoIterator<Item = SpecFlag>) -> Self
pub fn flags(self, flags: impl IntoIterator<Item = SpecFlag>) -> Self
Add multiple flags at once
Sourcepub fn args(self, args: impl IntoIterator<Item = SpecArg>) -> Self
pub fn args(self, args: impl IntoIterator<Item = SpecArg>) -> Self
Add multiple arguments at once
Sourcepub fn subcommand_required(self, required: bool) -> Self
pub fn subcommand_required(self, required: bool) -> Self
Set subcommand required
Sourcepub fn subcommand_help_heading(self, heading: impl Into<String>) -> Self
pub fn subcommand_help_heading(self, heading: impl Into<String>) -> Self
Set the heading for this command’s subcommand list.
Sourcepub fn subcommand_value_name(self, name: impl Into<String>) -> Self
pub fn subcommand_value_name(self, name: impl Into<String>) -> Self
Set the synopsis placeholder for a subcommand.
Sourcepub fn term_width(self, width: usize) -> Self
pub fn term_width(self, width: usize) -> Self
Set a fixed help width. Zero disables wrapping.
Sourcepub fn max_term_width(self, width: usize) -> Self
pub fn max_term_width(self, width: usize) -> Self
Cap detected terminal width when no fixed width is set. Zero disables the cap.
Sourcepub fn external_subcommand(self, enabled: bool) -> Self
pub fn external_subcommand(self, enabled: bool) -> Self
Forward an unmatched word as an external command plus the rest of argv
Sourcepub fn disable_help_flag(self, disabled: bool) -> Self
pub fn disable_help_flag(self, disabled: bool) -> Self
Enable or disable the synthesized --help and -h flags.
Sourcepub fn disable_help_subcommand(self, disabled: bool) -> Self
pub fn disable_help_subcommand(self, disabled: bool) -> Self
Enable or disable the synthesized help subcommand route.
Sourcepub fn disable_version_flag(self, disabled: bool) -> Self
pub fn disable_version_flag(self, disabled: bool) -> Self
Enable or disable the synthesized --version and -V flags.
Sourcepub fn args_override_self(self, enabled: bool) -> Self
pub fn args_override_self(self, enabled: bool) -> Self
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) -> Self
pub fn subcommand_negates_reqs(self, enabled: bool) -> Self
Set whether selecting a subcommand suppresses this command’s requirements.
Sourcepub fn args_conflicts_with_subcommands(self, enabled: bool) -> Self
pub fn args_conflicts_with_subcommands(self, enabled: bool) -> Self
Set whether arguments on this command exclude a later subcommand.
pub fn subcommand_precedence_over_arg(self, enabled: bool) -> Self
pub fn allow_missing_positional(self, enabled: bool) -> Self
Sourcepub fn effect(self, effect: SpecCommandEffect) -> Self
pub fn effect(self, effect: SpecCommandEffect) -> Self
Set what running this command does to the world
Sourcepub fn deprecated(self, msg: impl Into<String>) -> Self
pub fn deprecated(self, msg: impl Into<String>) -> Self
Set deprecated message
pub fn deprecated_warn_at(self, version: impl Into<String>) -> Self
pub fn deprecated_remove_at(self, version: impl Into<String>) -> Self
Sourcepub fn restart_token(self, token: impl Into<String>) -> Self
pub fn restart_token(self, token: impl Into<String>) -> Self
Set restart token for resetting argument parsing
e.g., mise run lint ::: test ::: check with restart_token=“:::”
Sourcepub fn subcommand(self, cmd: SpecCommand) -> Self
pub fn subcommand(self, cmd: SpecCommand) -> Self
Add a subcommand (can be called multiple times)
Sourcepub fn subcommands(self, cmds: impl IntoIterator<Item = SpecCommand>) -> Self
pub fn subcommands(self, cmds: impl IntoIterator<Item = SpecCommand>) -> Self
Add multiple subcommands at once
Sourcepub fn before_help(self, text: impl Into<String>) -> Self
pub fn before_help(self, text: impl Into<String>) -> Self
Set before_help text (displayed before the help message)
Sourcepub fn before_help_long(self, text: impl Into<String>) -> Self
pub fn before_help_long(self, text: impl Into<String>) -> Self
Set before_help_long text
Sourcepub fn before_help_md(self, text: impl Into<String>) -> Self
pub fn before_help_md(self, text: impl Into<String>) -> Self
Set before_help markdown text
Sourcepub fn after_help(self, text: impl Into<String>) -> Self
pub fn after_help(self, text: impl Into<String>) -> Self
Set after_help text (displayed after the help message)
Sourcepub fn after_help_long(self, text: impl Into<String>) -> Self
pub fn after_help_long(self, text: impl Into<String>) -> Self
Set after_help_long text
Sourcepub fn after_help_md(self, text: impl Into<String>) -> Self
pub fn after_help_md(self, text: impl Into<String>) -> Self
Set after_help markdown text
Sourcepub fn example(self, code: impl Into<String>) -> Self
pub fn example(self, code: impl Into<String>) -> Self
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>,
) -> Self
pub fn example_with_help( self, code: impl Into<String>, header: impl Into<String>, help: impl Into<String>, ) -> Self
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