@@ -83,37 +83,52 @@ pub fn cli() -> App {
83
83
}
84
84
85
85
pub fn exec ( config : & mut Config , args : & ArgMatches < ' _ > ) -> CliResult {
86
- if args. is_present ( "no-indent" ) {
87
- return Err ( format_err ! ( "the --no-indent flag has been changed to --prefix=none" ) . into ( ) ) ;
88
- }
89
- if args. is_present ( "prefix-depth" ) {
90
- return Err (
91
- format_err ! ( "the --prefix-depth flag has been changed to --prefix=depth" ) . into ( ) ,
92
- ) ;
93
- }
86
+ let prefix = if args. is_present ( "no-indent" ) {
87
+ config
88
+ . shell ( )
89
+ . warn ( "the --no-indent flag has been changed to --prefix=none" ) ?;
90
+ "none"
91
+ } else if args. is_present ( "prefix-depth" ) {
92
+ config
93
+ . shell ( )
94
+ . warn ( "the --prefix-depth flag has been changed to --prefix=depth" ) ?;
95
+ "depth"
96
+ } else {
97
+ args. value_of ( "prefix" ) . unwrap ( )
98
+ } ;
99
+ let prefix = tree:: Prefix :: from_str ( prefix) . map_err ( |e| anyhow:: anyhow!( "{}" , e) ) ?;
100
+
94
101
if args. is_present ( "all" ) {
95
102
return Err ( format_err ! (
96
103
"The `cargo tree` --all flag has been changed to --no-dedupe.\n \
97
104
If you are looking to display all workspace members, use the --workspace flag."
98
105
)
99
106
. into ( ) ) ;
100
107
}
101
- if args. is_present ( "all-targets" ) {
102
- return Err ( format_err ! ( "the --all-targets flag has been changed to --target=all" ) . into ( ) ) ;
103
- }
104
- if args. is_present ( "no-dev-dependencies" ) {
105
- return Err ( format_err ! (
106
- "the --no-dev-dependencies flag has changed to --dep-kinds=no-dev"
107
- )
108
- . into ( ) ) ;
109
- }
108
+
109
+ let target = if args. is_present ( "all-targets" ) {
110
+ config
111
+ . shell ( )
112
+ . warn ( "the --all-targets flag has been changed to --target=all" ) ?;
113
+ Some ( "all" )
114
+ } else {
115
+ args. value_of ( "target" )
116
+ } ;
117
+ let target = tree:: Target :: from_cli ( target) ;
118
+
119
+ let dep_kinds = if args. is_present ( "no-dev-dependencies" ) {
120
+ config
121
+ . shell ( )
122
+ . warn ( "the --no-dev-dependencies flag has changed to --dep-kinds=no-dev" ) ?;
123
+ Some ( "no-dev" )
124
+ } else {
125
+ args. value_of ( "dep-kinds" )
126
+ } ;
127
+ let dep_kinds = parse_dep_kinds ( dep_kinds) ?;
128
+
110
129
let ws = args. workspace ( config) ?;
111
130
let charset = tree:: Charset :: from_str ( args. value_of ( "charset" ) . unwrap ( ) )
112
131
. map_err ( |e| anyhow:: anyhow!( "{}" , e) ) ?;
113
- let prefix = tree:: Prefix :: from_str ( args. value_of ( "prefix" ) . unwrap ( ) )
114
- . map_err ( |e| anyhow:: anyhow!( "{}" , e) ) ?;
115
- let target = tree:: Target :: from_cli ( args. value_of ( "target" ) ) ;
116
- let dep_kinds = parse_dep_kinds ( args. value_of ( "dep-kinds" ) ) ?;
117
132
let opts = tree:: TreeOptions {
118
133
features : values ( args, "features" ) ,
119
134
all_features : args. is_present ( "all-features" ) ,
0 commit comments