File tree Expand file tree Collapse file tree 2 files changed +34
-5
lines changed Expand file tree Collapse file tree 2 files changed +34
-5
lines changed Original file line number Diff line number Diff line change @@ -100,11 +100,11 @@ pub trait AppExt: Sized {
100
100
}
101
101
102
102
fn arg_features ( self ) -> Self {
103
- self . _arg (
104
- opt ( "features" , "Space-separated list of features to activate" )
105
- . multiple ( true )
106
- . value_name ( "FEATURES" ) ,
107
- )
103
+ self . _arg ( multi_opt (
104
+ "features" ,
105
+ "FEATURES" ,
106
+ "Space-separated list of features to activate" ,
107
+ ) )
108
108
. _arg ( opt ( "all-features" , "Activate all available features" ) )
109
109
. _arg ( opt (
110
110
"no-default-features" ,
Original file line number Diff line number Diff line change @@ -1959,3 +1959,32 @@ fn multi_multi_features() {
1959
1959
1960
1960
p. cargo ( "build --features a --features" ) . arg ( "b c" ) . run ( ) ;
1961
1961
}
1962
+
1963
+ #[ cargo_test]
1964
+ fn cli_parse_ok ( ) {
1965
+ let p = project ( )
1966
+ . file (
1967
+ "Cargo.toml" ,
1968
+ r#"
1969
+ [project]
1970
+ name = "foo"
1971
+ version = "0.0.1"
1972
+ authors = []
1973
+
1974
+ [features]
1975
+ a = []
1976
+ "# ,
1977
+ )
1978
+ . file (
1979
+ "src/main.rs" ,
1980
+ r#"
1981
+ #[cfg(feature = "a")]
1982
+ fn main() {
1983
+ assert_eq!(std::env::args().nth(1).unwrap(), "b");
1984
+ }
1985
+ "# ,
1986
+ )
1987
+ . build ( ) ;
1988
+
1989
+ p. cargo ( "run --features a b" ) . run ( ) ;
1990
+ }
You can’t perform that action at this time.
0 commit comments