@@ -22,14 +22,21 @@ pub fn cli() -> Command {
2222 . arg_silent_suggestion ( )
2323 . arg ( flag ( "no-dev-dependencies" , "Deprecated, use -e=no-dev instead" ) . hide ( true ) )
2424 . arg (
25- multi_opt (
26- "edges" ,
27- "KINDS" ,
28- "The kinds of dependencies to display \
29- (features, normal, build, dev, all, \
30- no-normal, no-build, no-dev, no-proc-macro)",
31- )
32- . short ( 'e' ) ,
25+ multi_opt ( "edges" , "KINDS" , "The kinds of dependencies to display" )
26+ . short ( 'e' )
27+ . value_delimiter ( ',' )
28+ . value_parser ( [
29+ "all" ,
30+ "normal" ,
31+ "build" ,
32+ "dev" ,
33+ "features" ,
34+ "public" ,
35+ "no-normal" ,
36+ "no-build" ,
37+ "no-dev" ,
38+ "no-proc-macro" ,
39+ ] ) ,
3340 )
3441 . arg (
3542 optional_multi_opt (
@@ -42,11 +49,16 @@ pub fn cli() -> Command {
4249 get_pkg_id_spec_candidates,
4350 ) ) ,
4451 )
45- . arg ( multi_opt (
46- "prune" ,
47- "SPEC" ,
48- "Prune the given package from the display of the dependency tree" ,
49- ) )
52+ . arg (
53+ multi_opt (
54+ "prune" ,
55+ "SPEC" ,
56+ "Prune the given package from the display of the dependency tree" ,
57+ )
58+ . add ( clap_complete:: ArgValueCandidates :: new (
59+ get_pkg_id_spec_candidates,
60+ ) ) ,
61+ )
5062 . arg ( opt ( "depth" , "Maximum display depth of the dependency tree" ) . value_name ( "DEPTH" ) )
5163 . arg ( flag ( "no-indent" , "Deprecated, use --prefix=none instead" ) . hide ( true ) )
5264 . arg ( flag ( "prefix-depth" , "Deprecated, use --prefix=depth instead" ) . hide ( true ) )
@@ -266,7 +278,7 @@ fn parse_edge_kinds(
266278 let mut kinds = args. get_many :: < String > ( "edges" ) . map_or_else (
267279 || Vec :: new ( ) ,
268280 |es| {
269- es. flat_map ( |e| e. split ( ',' ) )
281+ es. map ( |e| e. as_str ( ) )
270282 . filter ( |e| {
271283 if * e == "no-proc-macro" {
272284 no_proc_macro = true ;
@@ -305,15 +317,6 @@ fn parse_edge_kinds(
305317 result. insert ( EdgeKind :: Dep ( DepKind :: Build ) ) ;
306318 result. insert ( EdgeKind :: Dep ( DepKind :: Development ) ) ;
307319 } ;
308- let unknown = |k| {
309- bail ! (
310- "unknown edge kind `{}`, valid values are \
311- \" normal\" , \" build\" , \" dev\" , \
312- \" no-normal\" , \" no-build\" , \" no-dev\" , \" no-proc-macro\" , \
313- \" features\" , or \" all\" ",
314- k
315- )
316- } ;
317320 if kinds. iter ( ) . any ( |k| k. starts_with ( "no-" ) ) {
318321 insert_defaults ( & mut result) ;
319322 for kind in & kinds {
@@ -330,7 +333,7 @@ fn parse_edge_kinds(
330333 kind
331334 )
332335 }
333- k => return unknown ( k ) ,
336+ _ => unreachable ! ( "`{kind}` was validated by clap" ) ,
334337 } ;
335338 }
336339 return Ok ( ( result, no_proc_macro, public) ) ;
@@ -353,7 +356,7 @@ fn parse_edge_kinds(
353356 "dev" => {
354357 result. insert ( EdgeKind :: Dep ( DepKind :: Development ) ) ;
355358 }
356- k => return unknown ( k ) ,
359+ _ => unreachable ! ( "`{kind}` was validated by clap" ) ,
357360 }
358361 }
359362 if kinds. len ( ) == 1 && kinds[ 0 ] == "features" {
0 commit comments