File tree Expand file tree Collapse file tree 1 file changed +55
-13
lines changed
examples/catch-all-advanced Expand file tree Collapse file tree 1 file changed +55
-13
lines changed Original file line number Diff line number Diff line change @@ -41,21 +41,14 @@ commands:
4141- name : upload
4242 short : u
4343 help : Upload a file
44- args :
45- - name : source
46- required : true
47- help : File to upload
4844
49- flags :
50- - long : --user
51- short : -u
52- arg : user
53- help : Username to use for logging in
45+ # Configure catch_all for the `upload` sub-command using the extended
46+ # syntax, and specifying that `catch_all` is required (which means that at
47+ # least one extra argument must be provided)
48+ catch_all :
49+ label : Files
50+ help : Files to upload
5451 required : true
55- - long : --password
56- short : -p
57- arg : password
58- help : Password to use for logging in
5952` ` `
6053
6154## Generated script output
@@ -158,5 +151,54 @@ other_args:
158151
159152` ` `
160153
154+ # ## `$ ./cli upload -h`
155+
156+ ` ` ` shell
157+ cli upload - Upload a file
158+
159+ Shortcut: u
160+
161+ Usage:
162+ cli upload FILES...
163+ cli upload --help | -h
164+
165+ Options:
166+ --help, -h
167+ Show this help
168+
169+ Arguments:
170+ FILES...
171+ Files to upload
172+
173+
174+
175+ ` ` `
176+
177+ # ## `$ ./cli upload`
178+
179+ ` ` ` shell
180+ missing required argument: FILES...
181+ usage: cli upload FILES...
182+
183+
184+ ` ` `
185+
186+ # ## `$ ./cli upload file1 "file 2" file3`
187+
188+ ` ` ` shell
189+ # this file is located in 'src/upload_command.sh'
190+ # code for 'cli upload' goes here
191+ # you can edit it freely and regenerate (it will not be overwritten)
192+ args: none
193+
194+ other_args:
195+ - ${other_args[*]} = file1 file 2 file3
196+ - ${other_args[0]} = file1
197+ - ${other_args[1]} = file 2
198+ - ${other_args[2]} = file3
199+
200+
201+ ` ` `
202+
161203
162204
You can’t perform that action at this time.
0 commit comments