@@ -11,56 +11,56 @@ impl DynCommand for Command {
1111 "dtx"
1212 }
1313
14- fn build ( & self ) -> clap:: App < ' static , ' static > {
15- use clap:: { AppSettings , SubCommand } ;
16-
17- SubCommand :: with_name ( self . name ( ) )
14+ fn build ( & self ) -> clap:: Command {
15+ clap:: Command :: new ( self . name ( ) )
1816 . about ( "Control the latch/dtx-system on the Surface Book 2" )
19- . setting ( AppSettings :: SubcommandRequiredElseHelp )
20- . subcommand ( SubCommand :: with_name ( "lock" )
17+ . subcommand_required ( true )
18+ . arg_required_else_help ( true )
19+ . infer_subcommands ( true )
20+ . subcommand ( clap:: Command :: new ( "lock" )
2121 . about ( "Lock the latch" )
2222 . display_order ( 1 ) )
23- . subcommand ( SubCommand :: with_name ( "unlock" )
23+ . subcommand ( clap :: Command :: new ( "unlock" )
2424 . about ( "Unlock the latch" )
2525 . display_order ( 2 ) )
26- . subcommand ( SubCommand :: with_name ( "request" )
26+ . subcommand ( clap :: Command :: new ( "request" )
2727 . about ( "Request latch-open or abort if already in progress" )
2828 . display_order ( 3 ) )
29- . subcommand ( SubCommand :: with_name ( "confirm" )
29+ . subcommand ( clap :: Command :: new ( "confirm" )
3030 . about ( "Confirm latch-open if detachment in progress" )
3131 . display_order ( 4 ) )
32- . subcommand ( SubCommand :: with_name ( "heartbeat" )
32+ . subcommand ( clap :: Command :: new ( "heartbeat" )
3333 . about ( "Send heartbeat if detachment in progress" )
3434 . display_order ( 5 ) )
35- . subcommand ( SubCommand :: with_name ( "cancel" )
35+ . subcommand ( clap :: Command :: new ( "cancel" )
3636 . about ( "Cancel any detachment in progress" )
3737 . display_order ( 6 ) )
38- . subcommand ( SubCommand :: with_name ( "get-base" )
38+ . subcommand ( clap :: Command :: new ( "get-base" )
3939 . about ( "Get information about the currently attached base" )
4040 . display_order ( 7 ) )
41- . subcommand ( SubCommand :: with_name ( "get-devicemode" )
41+ . subcommand ( clap :: Command :: new ( "get-devicemode" )
4242 . about ( "Query the current device operation mode" )
4343 . display_order ( 8 ) )
44- . subcommand ( SubCommand :: with_name ( "get-latchstatus" )
44+ . subcommand ( clap :: Command :: new ( "get-latchstatus" )
4545 . about ( "Query the current latch status" )
4646 . display_order ( 9 ) )
47- . subcommand ( SubCommand :: with_name ( "monitor" )
47+ . subcommand ( clap :: Command :: new ( "monitor" )
4848 . about ( "Monitor DTX events" )
4949 . display_order ( 10 ) )
5050 }
5151
5252 fn execute ( & self , m : & clap:: ArgMatches ) -> Result < ( ) > {
5353 match m. subcommand ( ) {
54- ( "lock" , Some ( m) ) => self . lock ( m) ,
55- ( "unlock" , Some ( m) ) => self . unlock ( m) ,
56- ( "request" , Some ( m) ) => self . request ( m) ,
57- ( "confirm" , Some ( m) ) => self . confirm ( m) ,
58- ( "heartbeat" , Some ( m) ) => self . heartbeat ( m) ,
59- ( "cancel" , Some ( m) ) => self . cancel ( m) ,
60- ( "get-base" , Some ( m) ) => self . get_base_info ( m) ,
61- ( "get-devicemode" , Some ( m) ) => self . get_device_mode ( m) ,
62- ( "get-latchstatus" , Some ( m) ) => self . get_latch_status ( m) ,
63- ( "monitor" , Some ( m) ) => self . monitor ( m) ,
54+ Some ( ( "lock" , m) ) => self . lock ( m) ,
55+ Some ( ( "unlock" , m) ) => self . unlock ( m) ,
56+ Some ( ( "request" , m) ) => self . request ( m) ,
57+ Some ( ( "confirm" , m) ) => self . confirm ( m) ,
58+ Some ( ( "heartbeat" , m) ) => self . heartbeat ( m) ,
59+ Some ( ( "cancel" , m) ) => self . cancel ( m) ,
60+ Some ( ( "get-base" , m) ) => self . get_base_info ( m) ,
61+ Some ( ( "get-devicemode" , m) ) => self . get_device_mode ( m) ,
62+ Some ( ( "get-latchstatus" , m) ) => self . get_latch_status ( m) ,
63+ Some ( ( "monitor" , m) ) => self . monitor ( m) ,
6464 _ => unreachable ! ( ) ,
6565 }
6666 }
0 commit comments