1- # Command Groups Example
1+ # Command Filenames Example
22
3- Demonstrates how to visually group commands under their own caption. This is
4- useful for scripts that contain many commands that provide different sets of
5- functionality.
3+ Demonstrates how to specify custom filenames for command source files.
4+ This is useful for scripts with many commands, in case you wish to organize
5+ your source files in sub-folders.
6+
7+ Note that the specified path is relative to the ` sec ` folder.
68
79This example was generated with:
810
@@ -17,86 +19,77 @@ $ bashly generate
1719## ` bashly.yml `
1820
1921``` yaml
20- name : ftp
21- help : Sample application with command grouping
22+ name : cli
23+ help : Demonstrate custom command filenames
2224version : 0.1.0
2325
2426commands :
25- - name : download
26- help : Download a file
27-
28- # By specifying a group, the `download` comnmand (and all subsequent
29- # commands until the next `group`) will be printed under this `File`
30- # caption.
31- group : File
32-
33- args :
34- - name : file
35- required : true
36- help : File to download
37-
38- - name : upload
39- help : Upload a file
40-
41- args :
42- - name : file
43- required : true
44- help : File to upload
45-
46- - name : login
47- help : Write login credentials to the config file
48-
49- # The `login` command (and all subsequent commands) will be printed under
50- # the `Login` caption.
51- group : Login
52-
53- - name : logout
54- help : Delete login credentials to the config file
27+ - name : dir
28+ short : d
29+ help : Directory commands
30+
31+ commands :
32+ - name : list
33+ help : Show files in the directory
34+
35+ # Define a custom filename for this command source.
36+ # This is relative to the `src` directory, and sub-directories will be
37+ # created as needed.
38+ filename : dir_commands/list.sh
39+
40+ - name : remove
41+ help : Remove directory
42+ filename : dir_commands/remove.sh
43+
44+ - name : file
45+ short : f
46+ help : File commands
47+
48+ commands :
49+ - name : show
50+ help : Show file contents
51+ filename : file_commands/show.sh
52+
53+ - name : edit
54+ help : Edit the file
55+ filename : file_commands/edit.sh
5556` ` `
5657
5758
5859
5960## Generated script output
6061
61- ### ` $ ./ftp `
62+ ### ` $ ./cli `
6263
6364` ` ` shell
64- ftp - Sample application with command grouping
65+ cli - Demonstrate custom command filenames
6566
6667Usage:
67- ftp [command]
68- ftp [command] --help | -h
69- ftp --version | -v
68+ cli [command]
69+ cli [command] --help | -h
70+ cli --version | -v
7071
71- File Commands:
72- download Download a file
73- upload Upload a file
74-
75- Login Commands:
76- login Write login credentials to the config file
77- logout Delete login credentials to the config file
72+ Commands:
73+ dir Directory commands
74+ file File commands
7875
7976
8077
8178` ` `
8279
83- # ## `$ ./ftp -h`
80+ # ## `$ ./cli -h`
8481
8582` ` ` shell
86- ftp - Sample application with command grouping
83+ cli - Demonstrate custom command filenames
8784
8885Usage:
89- ftp [command]
90- ftp [command] --help | -h
91- ftp --version | -v
92-
93- File Commands:
94- download Download a file
95- upload Upload a file
86+ cli [command]
87+ cli [command] --help | -h
88+ cli --version | -v
9689
97- Login Commands:
98- login Write login credentials to the config file
99- logout Delete login credentials to the config file
90+ Commands:
91+ dir Directory commands
92+ file File commands
10093
10194Options:
10295 --help, -h
@@ -109,11 +102,11 @@ Options:
109102
110103` ` `
111104
112- # ## `$ ./ftp login `
105+ # ## `$ ./cli dir list `
113106
114107` ` ` shell
115- # this file is located in 'src/login_command .sh'
116- # code for 'ftp login ' goes here
108+ # this file is located in 'src/dir_commands/list .sh'
109+ # code for 'cli dir list ' goes here
117110# you can edit it freely and regenerate (it will not be overwritten)
118111args: none
119112
0 commit comments