@@ -6,22 +6,76 @@ fn main() {
6
6
let gpio_cmd_matches = App :: new ( "GPIO Utils" )
7
7
. version ( env ! ( "CARGO_PKG_VERSION" ) )
8
8
. about ( "Read, Write, and Configure GPIOs" )
9
+
10
+ // Global options
11
+ . arg ( Arg :: with_name ( "config" )
12
+ . help ( "additional configuration to use" )
13
+ . takes_value ( true )
14
+ . short ( "c" )
15
+ . long ( "config" )
16
+ . multiple ( true )
17
+ . required ( false ) )
18
+
19
+ // gpio read
9
20
. subcommand ( SubCommand :: with_name ( "read" )
10
- . about ( "Read the value of a GPIO Input" ) )
21
+ . about ( "Read the value of a GPIO Input" )
22
+ . arg ( Arg :: with_name ( "pin" )
23
+ . help ( "The pin name (or number)" )
24
+ . index ( 1 )
25
+ . required ( true ) ) )
26
+
27
+ // gpio poll
11
28
. subcommand ( SubCommand :: with_name ( "poll" )
12
- . about ( "Wait for an event to happen on an GPIO Input" ) )
29
+ . about ( "Wait for an event to happen on an GPIO Input" )
30
+ . arg ( Arg :: with_name ( "pin" )
31
+ . help ( "The pin name (or number)" )
32
+ . index ( 1 )
33
+ . required ( true ) ) )
34
+
35
+ // gpio write
13
36
. subcommand ( SubCommand :: with_name ( "write" )
14
- . about ( "Write the value of a GPIO Output" ) )
37
+ . about ( "Write the value of a GPIO Output" )
38
+ . arg ( Arg :: with_name ( "pin" )
39
+ . help ( "The pin name (or number)" )
40
+ . index ( 1 )
41
+ . required ( true ) ) )
42
+
43
+ // gpio export
15
44
. subcommand ( SubCommand :: with_name ( "export" )
16
- . about ( "Export a given GPIO" ) )
45
+ . about ( "Export a given GPIO" )
46
+ . arg ( Arg :: with_name ( "pin" )
47
+ . help ( "The pin name (or number)" )
48
+ . index ( 1 )
49
+ . required ( true ) ) )
50
+
51
+ // gpio export-all
17
52
. subcommand ( SubCommand :: with_name ( "export-all" )
18
53
. about ( "Export all configured GPIOs" ) )
54
+
55
+ // gpio unexport
19
56
. subcommand ( SubCommand :: with_name ( "unexport" )
20
- . about ( "Unexport a given GPIO" ) )
57
+ . about ( "Unexport a given GPIO" )
58
+ . arg ( Arg :: with_name ( "pin" )
59
+ . help ( "The pin name (or number)" )
60
+ . index ( 1 )
61
+ . required ( true ) ) )
62
+
63
+ // gpio unexport-all
21
64
. subcommand ( SubCommand :: with_name ( "unexport-all" )
22
- . about ( "Unexport all configured, exported GPIOs" ) )
65
+ . about ( "Unexport all configured, exported GPIOs" )
66
+ . arg ( Arg :: with_name ( "pin" )
67
+ . help ( "The pin name (or number)" )
68
+ . index ( 1 )
69
+ . required ( true ) ) )
70
+
71
+ // gpio status
23
72
. subcommand ( SubCommand :: with_name ( "status" )
24
- . about ( "Output status of all configured GPIOs" ) )
73
+ . about ( "Output status of all configured GPIOs" )
74
+ . arg ( Arg :: with_name ( "pin" )
75
+ . help ( "The pin name (or number)" )
76
+ . index ( 1 )
77
+ . required ( false ) ) )
78
+
25
79
. get_matches ( ) ;
26
80
27
81
match gpio_cmd_matches. subcommand ( ) {
0 commit comments