@@ -33,6 +33,7 @@ pub use crate::Compiler;
33
33
// - use std::lazy for `Lazy`
34
34
// - use std::cell for `OnceCell`
35
35
// Once they get stabilized and reach beta.
36
+ use clap:: ValueEnum ;
36
37
use once_cell:: sync:: { Lazy , OnceCell } ;
37
38
38
39
pub struct Builder < ' a > {
@@ -576,19 +577,24 @@ impl<'a> ShouldRun<'a> {
576
577
}
577
578
}
578
579
579
- #[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Debug ) ]
580
+ #[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Debug , ValueEnum ) ]
580
581
pub enum Kind {
582
+ #[ clap( alias = "b" ) ]
581
583
Build ,
584
+ #[ clap( alias = "c" ) ]
582
585
Check ,
583
586
Clippy ,
584
587
Fix ,
585
588
Format ,
589
+ #[ clap( alias = "t" ) ]
586
590
Test ,
587
591
Bench ,
592
+ #[ clap( alias = "d" ) ]
588
593
Doc ,
589
594
Clean ,
590
595
Dist ,
591
596
Install ,
597
+ #[ clap( alias = "r" ) ]
592
598
Run ,
593
599
Setup ,
594
600
Suggest ,
@@ -887,18 +893,19 @@ impl<'a> Builder<'a> {
887
893
}
888
894
889
895
pub fn new ( build : & Build ) -> Builder < ' _ > {
896
+ let paths = & build. config . paths ;
890
897
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[ ..] ) ,
902
909
Subcommand :: Format { .. } => ( Kind :: Format , & [ ] [ ..] ) ,
903
910
Subcommand :: Suggest { .. } => ( Kind :: Suggest , & [ ] [ ..] ) ,
904
911
Subcommand :: Setup { profile : ref path } => (
0 commit comments