#[non_exhaustive]
pub enum Subcommand {
Show 22 variants Build(Build), Clippy(Clippy), Dist(Dist), DistArchive(DistArchive), DistBuild(DistBuild), DistBuildBin(DistBuildBin), DistBuildCompletion(DistBuildCompletion), DistBuildDoc(DistBuildDoc), DistBuildLicense(DistBuildLicense), DistBuildMan(DistBuildMan), DistBuildReadme(DistBuildReadme), DistClean(DistClean), Doc(Doc), Docsrs(Docsrs), Exec(Exec), Fmt(Fmt), Lint(Lint), PreRelease(PreRelease), SyncRdme(SyncRdme), Test(Test), Tidy(Tidy), Udeps(Udeps),
}
Expand description

Subcommand definition for cargo xtask command.

cargo-xtask(1)

Rust project automation command

Usage: cargo xtask [OPTIONS] [COMMAND]

Commands:
  build                  `cargo build` with options useful for testing and continuous integration
  clippy                 `cargo clippy` with options useful for tesing and continuous integration
  dist                   Build the artifacs and create the archive file for distribution
  dist-archive           Create the archive file for distribution
  dist-build             Build all artifacts for distribution
  dist-build-bin         Build the release binaries for distribution
  dist-build-completion  Build the shell completion files for distribution
  dist-build-doc         Build the documentation for distribution
  dist-build-license     Build the license files for distribution
  dist-build-man         Build the man pages for distribution
  dist-build-readme      Build the readme files for distribution
  dist-clean             Remove the artifacts and archives for distribution
  doc                    `cargo doc` with options useful for testing and continuous integration
  docsrs                 `cargo doc` with docs.rs specific options
  exec                   Run commands on all workspaces in the current directory and subdirectories
  fmt                    `cargo fmt` with options useful for testing and continuous integration
  lint                   Run lint commands at once
  pre-release            Run pre-release checks
  sync-rdme              `cargo sync-rdme` with options useful for testing and continuous integration
  test                   `cargo test` with options useful for testing and continuous integration
  tidy                   Fix the package problems
  udeps                  `cargo udeps` with options useful for testing and continuous integration
  help                   Print this message or the help of the given subcommand(s)

Options:
  -v, --verbose...  More output per occurrence
  -q, --quiet...    Less output per occurrence
  -h, --help        Print help

Examples

You can use this struct to define a subcommand of your application:

use cli_xtask::{clap, config::Config, subcommand::Subcommand, Result};

#[derive(Debug, clap::Parser)]
struct App {
    #[clap(subcommand)]
    subcommand: Subcommand,
}

impl App {
    pub fn run(&self, config: &Config) -> Result<()> {
        self.subcommand.run(config)
    }
}

You can mix the subcommands defined in this enum with your own subcommands:

use cli_xtask::{clap, config::Config, Result};

#[derive(Debug, clap::Parser)]
struct App {
    #[clap(subcommand)]
    subcommand: YourOwnSubcommand,
}

#[derive(Debug, clap::Subcommand)]
enum YourOwnSubcommand {
    #[clap(flatten)]
    Predefined(cli_xtask::subcommand::Subcommand),
    Foo,
    Bar,
}

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Build(Build)

Available on crate feature subcommand-build only.

cargo build with options useful for testing and continuous integration.

§

Clippy(Clippy)

Available on crate feature subcommand-clippy only.

cargo clippy with options useful for tesing and continuous integration.

§

Dist(Dist)

Available on crate feature subcommand-dist only.

Build the artifacs and create the archive file for distribution.

§

DistArchive(DistArchive)

Available on crate feature subcommand-dist-archive only.

Create the archive file for distribution.

§

DistBuild(DistBuild)

Available on crate feature subcommand-dist-build-* only.

Build all artifacts for distribution.

§

DistBuildBin(DistBuildBin)

Available on crate feature subcommand-dist-build-bin only.

Build the release binaries for distribution.

§

DistBuildCompletion(DistBuildCompletion)

Available on crate feature subcommand-dist-build-completion only.

Build the shell completion files for distribution.

§

DistBuildDoc(DistBuildDoc)

Available on crate feature subcommand-dist-build-doc only.

Build the documentation for distribution.

§

DistBuildLicense(DistBuildLicense)

Available on crate feature subcommand-dist-build-license only.

Build the license files for distribution.

§

DistBuildMan(DistBuildMan)

Available on crate feature subcommand-dist-build-man only.

Build the man pages for distribution.

§

DistBuildReadme(DistBuildReadme)

Available on crate feature subcommand-dist-build-readme only.

Build the readme files for distribution.

§

DistClean(DistClean)

Available on crate feature subcommand-dist-clean only.

Remove the artifacts and archives for distribution.

§

Doc(Doc)

Available on crate feature subcommand-doc only.

cargo doc with options useful for testing and continuous integration.

§

Docsrs(Docsrs)

Available on crate feature subcommand-docsrs only.

cargo doc with docs.rs specific options.

§

Exec(Exec)

Available on crate feature subcommand-exec only.

Run commands on all workspaces in the current directory and subdirectories.

§

Fmt(Fmt)

Available on crate feature subcommand-fmt only.

cargo fmt with options useful for testing and continuous integration.

§

Lint(Lint)

Available on crate feature subcommand-lint only.

Run lint commands at once.

§

PreRelease(PreRelease)

Available on crate feature subcommand-pre-release only.

Run pre-release checks.

§

SyncRdme(SyncRdme)

Available on crate feature subcommand-syncrdme only.

cargo sync-rdme with options useful for testing and continuous integration.

§

Test(Test)

Available on crate feature subcommand-test only.

cargo test with options useful for testing and continuous integration.

§

Tidy(Tidy)

Available on crate feature subcommand-tidy only.

Fix the package problems.

§

Udeps(Udeps)

Available on crate feature subcommand-udeps only.

cargo udeps with options useful for testing and continuous integration.

Implementations§

source§

impl Subcommand

source

pub fn selected(&self) -> &dyn Run

Returns the selected subcommand.

source

pub fn run(&self, config: &Config<'_>) -> Result<()>

Runs the subcommand specified by the command line arguments.

Trait Implementations§

source§

impl Debug for Subcommand

source§

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

Formats the value using the given formatter. Read more
source§

impl FromArgMatches for Subcommand

source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches ) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches ) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches ) -> Result<(), Error>

Assign values from ArgMatches to self.
source§

impl Run for Subcommand

source§

fn run(&self, config: &Config<'_>) -> Result<()>

Runs the command or subcommand.
source§

fn into_any(self: Box<Self>) -> Box<dyn Any>

Converts the Box<dyn Run> to Box<dyn Any>.
source§

fn as_any(&self) -> &dyn Any

Converts the &dyn Run trait object to a concrete type.
source§

fn as_any_mut(&mut self) -> &mut dyn Any

Converts the &dyn Run trait object to a mutable concrete type.
source§

fn to_subcommands(&self) -> Option<SubcommandRun>

Returns the subcommands that this command will run.
source§

impl Subcommand for Subcommand

source§

fn augment_subcommands<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self. Read more
source§

fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can update self. Read more
source§

fn has_subcommand(__clap_name: &str) -> bool

Test whether Self can parse a specific subcommand

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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.

§

impl<D> OwoColorize for D

§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where C: Color,

Set the foreground color generically Read more
§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where C: Color,

Set the background color generically. Read more
§

fn black<'a>(&'a self) -> FgColorDisplay<'a, Black, Self>

Change the foreground color to black
§

fn on_black<'a>(&'a self) -> BgColorDisplay<'a, Black, Self>

Change the background color to black
§

fn red<'a>(&'a self) -> FgColorDisplay<'a, Red, Self>

Change the foreground color to red
§

fn on_red<'a>(&'a self) -> BgColorDisplay<'a, Red, Self>

Change the background color to red
§

fn green<'a>(&'a self) -> FgColorDisplay<'a, Green, Self>

Change the foreground color to green
§

fn on_green<'a>(&'a self) -> BgColorDisplay<'a, Green, Self>

Change the background color to green
§

fn yellow<'a>(&'a self) -> FgColorDisplay<'a, Yellow, Self>

Change the foreground color to yellow
§

fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>

Change the background color to yellow
§

fn blue<'a>(&'a self) -> FgColorDisplay<'a, Blue, Self>

Change the foreground color to blue
§

fn on_blue<'a>(&'a self) -> BgColorDisplay<'a, Blue, Self>

Change the background color to blue
§

fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>

Change the foreground color to magenta
§

fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>

Change the background color to magenta
§

fn purple<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>

Change the foreground color to purple
§

fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>

Change the background color to purple
§

fn cyan<'a>(&'a self) -> FgColorDisplay<'a, Cyan, Self>

Change the foreground color to cyan
§

fn on_cyan<'a>(&'a self) -> BgColorDisplay<'a, Cyan, Self>

Change the background color to cyan
§

fn white<'a>(&'a self) -> FgColorDisplay<'a, White, Self>

Change the foreground color to white
§

fn on_white<'a>(&'a self) -> BgColorDisplay<'a, White, Self>

Change the background color to white
§

fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>

Change the foreground color to the terminal default
§

fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>

Change the background color to the terminal default
§

fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>

Change the foreground color to bright black
§

fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>

Change the background color to bright black
§

fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>

Change the foreground color to bright red
§

fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>

Change the background color to bright red
§

fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>

Change the foreground color to bright green
§

fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>

Change the background color to bright green
§

fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>

Change the foreground color to bright yellow
§

fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>

Change the background color to bright yellow
§

fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>

Change the foreground color to bright blue
§

fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>

Change the background color to bright blue
§

fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>

Change the foreground color to bright magenta
§

fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>

Change the background color to bright magenta
§

fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>

Change the foreground color to bright purple
§

fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>

Change the background color to bright purple
§

fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>

Change the foreground color to bright cyan
§

fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>

Change the background color to bright cyan
§

fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>

Change the foreground color to bright white
§

fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>

Change the background color to bright white
§

fn bold<'a>(&'a self) -> BoldDisplay<'a, Self>

Make the text bold
§

fn dimmed<'a>(&'a self) -> DimDisplay<'a, Self>

Make the text dim
§

fn italic<'a>(&'a self) -> ItalicDisplay<'a, Self>

Make the text italicized
§

fn underline<'a>(&'a self) -> UnderlineDisplay<'a, Self>

Make the text italicized
Make the text blink
Make the text blink (but fast!)
§

fn reversed<'a>(&'a self) -> ReversedDisplay<'a, Self>

Swap the foreground and background colors
§

fn hidden<'a>(&'a self) -> HiddenDisplay<'a, Self>

Hide the text
§

fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>

Cross out the text
§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more