diff options
Diffstat (limited to 'xtask/src/argument_parsing.rs')
-rw-r--r-- | xtask/src/argument_parsing.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/xtask/src/argument_parsing.rs b/xtask/src/argument_parsing.rs index 77433eef..3a89dfc5 100644 --- a/xtask/src/argument_parsing.rs +++ b/xtask/src/argument_parsing.rs @@ -209,7 +209,8 @@ pub enum Commands { FormatCheck(PackageOpt), /// Format code - Format(PackageOpt), + #[clap(alias = "fmt")] + Format(FormatOpt), /// Run clippy Clippy(PackageOpt), @@ -266,6 +267,15 @@ pub enum Commands { } #[derive(Args, Debug, Clone)] +pub struct FormatOpt { + #[clap(flatten)] + pub package: PackageOpt, + /// Only check formatting, without applying fixes. + #[clap(short, long, alias = "check-only")] + pub check: bool, +} + +#[derive(Args, Debug, Clone)] /// Restrict to package, or run on whole workspace pub struct PackageOpt { /// For which package/workspace member to operate @@ -315,3 +325,13 @@ pub enum ExtraArguments { #[command(external_subcommand)] Other(Vec<String>), } + +impl core::fmt::Display for ExtraArguments { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + ExtraArguments::Other(args) => { + write!(f, "{}", args.join(" ")) + } + } + } +} |