Skip to content

Commit fe599f3

Browse files
authored
Merge pull request #271 from DannyBen/add/global-flags
Add support for global command flags
2 parents bcbc7b4 + 6ff5596 commit fe599f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+587
-279
lines changed

examples/catch-all-advanced/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ commands:
7070
cli - Sample application
7171
7272
Usage:
73-
cli [command]
74-
cli [command] --help | -h
73+
cli COMMAND
74+
cli [COMMAND] --help | -h
7575
cli --version | -v
7676
7777
Commands:
@@ -90,7 +90,7 @@ cli download - Download a file
9090
Alias: d
9191
9292
Usage:
93-
cli download SOURCE [TARGET] [options] [AWS PARAMS...]
93+
cli download SOURCE [TARGET] [OPTIONS] [AWS PARAMS...]
9494
cli download --help | -h
9595
9696
Options:

examples/catch-all-stdin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ echo
7474
cli - Sample application
7575
7676
Usage:
77-
cli [options] [FILE...]
77+
cli [OPTIONS] [FILE...]
7878
cli --help | -h
7979
cli --version | -v
8080

examples/command-aliases/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ commands:
6767
cli - Sample application
6868
6969
Usage:
70-
cli [command]
71-
cli [command] --help | -h
70+
cli COMMAND
71+
cli [COMMAND] --help | -h
7272
cli --version | -v
7373
7474
Commands:
@@ -85,8 +85,8 @@ Commands:
8585
cli - Sample application
8686
8787
Usage:
88-
cli [command]
89-
cli [command] --help | -h
88+
cli COMMAND
89+
cli [COMMAND] --help | -h
9090
cli --version | -v
9191
9292
Commands:

examples/command-default/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ commands:
5555
ftp - Sample application that uses the default command option
5656
5757
Usage:
58-
ftp [command]
59-
ftp [command] --help | -h
58+
ftp COMMAND
59+
ftp [COMMAND] --help | -h
6060
ftp --version | -v
6161
6262
Commands:
@@ -73,8 +73,8 @@ Commands:
7373
ftp - Sample application that uses the default command option
7474
7575
Usage:
76-
ftp [command]
77-
ftp [command] --help | -h
76+
ftp COMMAND
77+
ftp [COMMAND] --help | -h
7878
ftp --version | -v
7979
8080
Commands:

examples/command-filenames/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ commands:
6565
cli - Demonstrate custom command filenames
6666
6767
Usage:
68-
cli [command]
69-
cli [command] --help | -h
68+
cli COMMAND
69+
cli [COMMAND] --help | -h
7070
cli --version | -v
7171
7272
Commands:
@@ -83,8 +83,8 @@ Commands:
8383
cli - Demonstrate custom command filenames
8484
8585
Usage:
86-
cli [command]
87-
cli [command] --help | -h
86+
cli COMMAND
87+
cli [COMMAND] --help | -h
8888
cli --version | -v
8989
9090
Commands:

examples/command-groups/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ commands:
6464
ftp - Sample application with command grouping
6565
6666
Usage:
67-
ftp [command]
68-
ftp [command] --help | -h
67+
ftp COMMAND
68+
ftp [COMMAND] --help | -h
6969
ftp --version | -v
7070
7171
File Commands:
@@ -86,8 +86,8 @@ Login Commands:
8686
ftp - Sample application with command grouping
8787
8888
Usage:
89-
ftp [command]
90-
ftp [command] --help | -h
89+
ftp COMMAND
90+
ftp [COMMAND] --help | -h
9191
ftp --version | -v
9292
9393
File Commands:

examples/command-private/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ $cmd
6262
cli - Sample application with private commands
6363
6464
Usage:
65-
cli [command]
66-
cli [command] --help | -h
65+
cli COMMAND
66+
cli [COMMAND] --help | -h
6767
cli --version | -v
6868
6969
Commands:
@@ -79,8 +79,8 @@ Commands:
7979
cli - Sample application with private commands
8080
8181
Usage:
82-
cli [command]
83-
cli [command] --help | -h
82+
cli COMMAND
83+
cli [COMMAND] --help | -h
8484
cli --version | -v
8585
8686
Commands:

examples/commands-expose/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ commands:
7474
cli
7575
7676
Usage:
77-
cli [command]
78-
cli [command] --help | -h
77+
cli COMMAND
78+
cli [COMMAND] --help | -h
7979
cli --version | -v
8080
8181
Commands:
@@ -98,8 +98,8 @@ Cluster Commands:
9898
cli
9999
100100
Usage:
101-
cli [command]
102-
cli [command] --help | -h
101+
cli COMMAND
102+
cli [COMMAND] --help | -h
103103
cli --version | -v
104104
105105
Commands:

examples/commands-nested/README.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ commands:
7474
cli - Sample application with nested commands
7575
7676
Usage:
77-
cli [command]
78-
cli [command] --help | -h
77+
cli COMMAND
78+
cli [COMMAND] --help | -h
7979
cli --version | -v
8080
8181
Commands:
@@ -92,8 +92,8 @@ Commands:
9292
cli - Sample application with nested commands
9393
9494
Usage:
95-
cli [command]
96-
cli [command] --help | -h
95+
cli COMMAND
96+
cli [COMMAND] --help | -h
9797
cli --version | -v
9898
9999
Commands:
@@ -119,8 +119,8 @@ cli dir - Directory commands
119119
Alias: d
120120
121121
Usage:
122-
cli dir [command]
123-
cli dir [command] --help | -h
122+
cli dir COMMAND
123+
cli dir [COMMAND] --help | -h
124124
125125
Commands:
126126
list Show files in the directory
@@ -138,15 +138,23 @@ cli file - File commands
138138
Alias: f
139139
140140
Usage:
141-
cli file [command]
142-
cli file [command] --help | -h
141+
cli file COMMAND
142+
cli file [COMMAND] --help | -h
143143
144144
Commands:
145145
show Show file contents
146146
edit Edit the file
147147
148148
149149
150+
```
151+
152+
### `$ ./cli dig`
153+
154+
```shell
155+
invalid command: dig
156+
157+
150158
```
151159

152160
### `$ ./cli dir -h`
@@ -157,8 +165,8 @@ cli dir - Directory commands
157165
Alias: d
158166
159167
Usage:
160-
cli dir [command]
161-
cli dir [command] --help | -h
168+
cli dir COMMAND
169+
cli dir [COMMAND] --help | -h
162170
163171
Commands:
164172
list Show files in the directory
@@ -180,8 +188,8 @@ cli file - File commands
180188
Alias: f
181189
182190
Usage:
183-
cli file [command]
184-
cli file [command] --help | -h
191+
cli file COMMAND
192+
cli file [COMMAND] --help | -h
185193
186194
Commands:
187195
show Show file contents
@@ -223,6 +231,14 @@ Arguments:
223231
224232
225233
234+
```
235+
236+
### `$ ./cli dir lost -h`
237+
238+
```shell
239+
invalid command: lost
240+
241+
226242
```
227243

228244
### `$ ./cli file edit`

examples/commands/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ commands:
7979
cli - Sample application
8080
8181
Usage:
82-
cli [command]
83-
cli [command] --help | -h
82+
cli COMMAND
83+
cli [COMMAND] --help | -h
8484
cli --version | -v
8585
8686
Commands:
@@ -97,8 +97,8 @@ Commands:
9797
cli - Sample application
9898
9999
Usage:
100-
cli [command]
101-
cli [command] --help | -h
100+
cli COMMAND
101+
cli [COMMAND] --help | -h
102102
cli --version | -v
103103
104104
Commands:
@@ -136,7 +136,7 @@ cli download - Download a file
136136
Alias: d
137137
138138
Usage:
139-
cli download SOURCE [TARGET] [options]
139+
cli download SOURCE [TARGET] [OPTIONS]
140140
cli download --help | -h
141141
142142
Options:
@@ -169,7 +169,7 @@ Examples:
169169

170170
```shell
171171
missing required argument: SOURCE
172-
usage: cli download SOURCE [TARGET] [options]
172+
usage: cli download SOURCE [TARGET] [OPTIONS]
173173
174174
175175
```
@@ -196,7 +196,7 @@ cli upload - Upload a file
196196
Alias: u
197197
198198
Usage:
199-
cli upload SOURCE [options]
199+
cli upload SOURCE [OPTIONS]
200200
cli upload --help | -h
201201
202202
Options:

0 commit comments

Comments
 (0)