@@ -33,6 +33,7 @@ pub use crate::Compiler;
3333// - use std::lazy for `Lazy`
3434// - use std::cell for `OnceCell`
3535// Once they get stabilized and reach beta.
36+ use clap:: ValueEnum ;
3637use once_cell:: sync:: { Lazy , OnceCell } ;
3738
3839pub struct Builder < ' a > {
@@ -576,19 +577,24 @@ impl<'a> ShouldRun<'a> {
576577 }
577578}
578579
579- #[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Debug ) ]
580+ #[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Debug , ValueEnum ) ]
580581pub enum Kind {
582+ #[ clap( alias = "b" ) ]
581583 Build ,
584+ #[ clap( alias = "c" ) ]
582585 Check ,
583586 Clippy ,
584587 Fix ,
585588 Format ,
589+ #[ clap( alias = "t" ) ]
586590 Test ,
587591 Bench ,
592+ #[ clap( alias = "d" ) ]
588593 Doc ,
589594 Clean ,
590595 Dist ,
591596 Install ,
597+ #[ clap( alias = "r" ) ]
592598 Run ,
593599 Setup ,
594600 Suggest ,
@@ -887,18 +893,19 @@ impl<'a> Builder<'a> {
887893 }
888894
889895 pub fn new ( build : & Build ) -> Builder < ' _ > {
896+ let paths = & build. config . paths ;
890897 let ( kind, paths) = match build. config . cmd {
891- Subcommand :: Build { ref paths } => ( Kind :: Build , & paths[ ..] ) ,
892- Subcommand :: Check { ref paths } => ( Kind :: Check , & paths[ ..] ) ,
893- Subcommand :: Clippy { ref paths , .. } => ( Kind :: Clippy , & paths[ ..] ) ,
894- Subcommand :: Fix { ref paths } => ( Kind :: Fix , & paths[ ..] ) ,
895- Subcommand :: Doc { ref paths , .. } => ( Kind :: Doc , & paths[ ..] ) ,
896- Subcommand :: Test { ref paths , .. } => ( Kind :: Test , & paths[ ..] ) ,
897- Subcommand :: Bench { ref paths , .. } => ( Kind :: Bench , & paths[ ..] ) ,
898- Subcommand :: Dist { ref paths } => ( Kind :: Dist , & paths[ ..] ) ,
899- Subcommand :: Install { ref paths } => ( Kind :: Install , & paths[ ..] ) ,
900- Subcommand :: Run { ref paths , .. } => ( Kind :: Run , & paths[ ..] ) ,
901- Subcommand :: Clean { ref paths , .. } => ( Kind :: Clean , & paths[ ..] ) ,
898+ Subcommand :: Build => ( Kind :: Build , & paths[ ..] ) ,
899+ Subcommand :: Check { .. } => ( Kind :: Check , & paths[ ..] ) ,
900+ Subcommand :: Clippy { .. } => ( Kind :: Clippy , & paths[ ..] ) ,
901+ Subcommand :: Fix => ( Kind :: Fix , & paths[ ..] ) ,
902+ Subcommand :: Doc { .. } => ( Kind :: Doc , & paths[ ..] ) ,
903+ Subcommand :: Test { .. } => ( Kind :: Test , & paths[ ..] ) ,
904+ Subcommand :: Bench { .. } => ( Kind :: Bench , & paths[ ..] ) ,
905+ Subcommand :: Dist => ( Kind :: Dist , & paths[ ..] ) ,
906+ Subcommand :: Install => ( Kind :: Install , & paths[ ..] ) ,
907+ Subcommand :: Run { .. } => ( Kind :: Run , & paths[ ..] ) ,
908+ Subcommand :: Clean { .. } => ( Kind :: Clean , & paths[ ..] ) ,
902909 Subcommand :: Format { .. } => ( Kind :: Format , & [ ] [ ..] ) ,
903910 Subcommand :: Suggest { .. } => ( Kind :: Suggest , & [ ] [ ..] ) ,
904911 Subcommand :: Setup { profile : ref path } => (
0 commit comments