Skip to content

Commit 1c8e0e6

Browse files
committed
improve output in example READMEs
1 parent 4b881d0 commit 1c8e0e6

File tree

24 files changed

+398
-136
lines changed

24 files changed

+398
-136
lines changed

Runfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,16 @@ class Example
8787
end
8888

8989
def test_output
90-
result = "```shell\n"
90+
result = ''
9191
test_commands.each do |command|
92-
result += "$ #{command}\n\n"
92+
result += "### `$ #{command}`\n\n"
93+
result += "```shell\n"
9394
Dir.chdir dir do
9495
result += `#{command} 2>&1`
9596
result += "\n\n"
9697
end
98+
result += "```\n\n"
9799
end
98-
result += "```\n\n"
99100
result
100101
end
101102

examples/catch-all-advanced/README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ commands:
6060
6161
## Generated script output
6262
63-
```shell
64-
$ ./cli
63+
### `$ ./cli`
6564

65+
```shell
6666
cli - Sample application
6767
6868
Usage:
@@ -76,8 +76,11 @@ Commands:
7676
7777
7878
79-
$ ./cli download -h
79+
```
80+
81+
### `$ ./cli download -h`
8082

83+
```shell
8184
cli download - Download a file
8285
8386
Shortcut: d
@@ -109,17 +112,23 @@ Examples:
109112
110113
111114
112-
$ ./cli download source
115+
```
116+
117+
### `$ ./cli download source`
113118

119+
```shell
114120
# this file is located in 'src/download_command.sh'
115121
# code for 'cli download' goes here
116122
# you can edit it freely and regenerate (it will not be overwritten)
117123
args:
118124
- ${args[source]} = source
119125
120126
121-
$ ./cli download source target
127+
```
128+
129+
### `$ ./cli download source target`
122130

131+
```shell
123132
# this file is located in 'src/download_command.sh'
124133
# code for 'cli download' goes here
125134
# you can edit it freely and regenerate (it will not be overwritten)
@@ -128,8 +137,11 @@ args:
128137
- ${args[target]} = target
129138
130139
131-
$ ./cli download source target and --additional stuff
140+
```
141+
142+
### `$ ./cli download source target and --additional stuff`
132143

144+
```shell
133145
# this file is located in 'src/download_command.sh'
134146
# code for 'cli download' goes here
135147
# you can edit it freely and regenerate (it will not be overwritten)

examples/catch-all/README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,18 @@ args:
2323
2424
## Generated script output
2525
26-
```shell
27-
$ ./download
26+
### `$ ./download`
2827

28+
```shell
2929
missing required argument: MESSAGE
3030
usage: download MESSAGE [...]
3131
3232
33-
$ ./download -h
33+
```
34+
35+
### `$ ./download -h`
3436

37+
```shell
3538
download - Catch All Example
3639
3740
Usage:
@@ -52,16 +55,22 @@ Arguments:
5255
5356
5457
55-
$ ./download something
58+
```
5659

60+
### `$ ./download something`
61+
62+
```shell
5763
# this file is located in 'src/root_command.sh'
5864
# you can edit it freely and regenerate (it will not be overwritten)
5965
args:
6066
- ${args[message]} = something
6167
6268
63-
$ ./download something with --additional args
69+
```
6470

71+
### `$ ./download something with --additional args`
72+
73+
```shell
6574
# this file is located in 'src/root_command.sh'
6675
# you can edit it freely and regenerate (it will not be overwritten)
6776
args:

examples/colors/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ args:
2929
3030
## Generated script output
3131
32-
```shell
33-
$ ./colorly
32+
### `$ ./colorly`
3433

34+
```shell
3535
Message Recevied:
3636
3737
=> hello colors

examples/command-default/README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ commands:
3838
3939
## Generated script output
4040
41-
```shell
42-
$ ./ftp
41+
### `$ ./ftp`
4342

43+
```shell
4444
ftp - Sample application that uses the default command option
4545
4646
Usage:
@@ -54,8 +54,11 @@ Commands:
5454
5555
5656
57-
$ ./ftp -h
57+
```
58+
59+
### `$ ./ftp -h`
5860

61+
```shell
5962
ftp - Sample application that uses the default command option
6063
6164
Usage:
@@ -76,26 +79,35 @@ Options:
7679
7780
7881
79-
$ ./ftp download something
82+
```
83+
84+
### `$ ./ftp download something`
8085

86+
```shell
8187
# this file is located in 'src/download_command.sh'
8288
# code for 'ftp download' goes here
8389
# you can edit it freely and regenerate (it will not be overwritten)
8490
args:
8591
- ${args[source]} = something
8692
8793
88-
$ ./ftp upload something
94+
```
95+
96+
### `$ ./ftp upload something`
8997

98+
```shell
9099
# this file is located in 'src/upload_command.sh'
91100
# code for 'ftp upload' goes here
92101
# you can edit it freely and regenerate (it will not be overwritten)
93102
args:
94103
- ${args[source]} = something
95104
96105
97-
$ ./ftp something
106+
```
107+
108+
### `$ ./ftp something`
98109

110+
```shell
99111
# this file is located in 'src/upload_command.sh'
100112
# code for 'ftp upload' goes here
101113
# you can edit it freely and regenerate (it will not be overwritten)

examples/command-groups/README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ commands:
4646
4747
## Generated script output
4848
49-
```shell
50-
$ ./ftp
49+
### `$ ./ftp`
5150

51+
```shell
5252
ftp - Sample application with command grouping
5353
5454
Usage:
@@ -66,8 +66,11 @@ Login Commands:
6666
6767
6868
69-
$ ./ftp -h
69+
```
70+
71+
### `$ ./ftp -h`
7072

73+
```shell
7174
ftp - Sample application with command grouping
7275
7376
Usage:
@@ -92,8 +95,11 @@ Options:
9295
9396
9497
95-
$ ./ftp login
98+
```
99+
100+
### `$ ./ftp login`
96101

102+
```shell
97103
# this file is located in 'src/login_command.sh'
98104
# code for 'ftp login' goes here
99105
# you can edit it freely and regenerate (it will not be overwritten)

examples/commands-nested/README.md

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ commands:
6363
6464
## Generated script output
6565
66-
```shell
67-
$ ./cli
66+
### `$ ./cli`
6867

68+
```shell
6969
cli - Sample application with nested commands
7070
7171
Usage:
@@ -79,8 +79,11 @@ Commands:
7979
8080
8181
82-
$ ./cli -h
82+
```
83+
84+
### `$ ./cli -h`
8385

86+
```shell
8487
cli - Sample application with nested commands
8588
8689
Usage:
@@ -101,8 +104,11 @@ Options:
101104
102105
103106
104-
$ ./cli dir
107+
```
108+
109+
### `$ ./cli dir`
105110

111+
```shell
106112
cli dir - Directory commands
107113
108114
Shortcut: d
@@ -117,8 +123,11 @@ Commands:
117123
118124
119125
120-
$ ./cli file
126+
```
127+
128+
### `$ ./cli file`
121129

130+
```shell
122131
cli file - File commands
123132
124133
Shortcut: f
@@ -133,8 +142,11 @@ Commands:
133142
134143
135144
136-
$ ./cli dir -h
145+
```
146+
147+
### `$ ./cli dir -h`
137148

149+
```shell
138150
cli dir - Directory commands
139151
140152
Shortcut: d
@@ -153,8 +165,11 @@ Options:
153165
154166
155167
156-
$ ./cli file -h
168+
```
169+
170+
### `$ ./cli file -h`
157171

172+
```shell
158173
cli file - File commands
159174
160175
Shortcut: f
@@ -173,14 +188,20 @@ Options:
173188
174189
175190
176-
$ ./cli dir list
191+
```
192+
193+
### `$ ./cli dir list`
177194

195+
```shell
178196
missing required argument: PATH
179197
usage: cli dir list PATH
180198
181199
182-
$ ./cli dir list -h
200+
```
201+
202+
### `$ ./cli dir list -h`
183203

204+
```shell
184205
cli dir list - Show files in the directory
185206
186207
Usage:
@@ -197,14 +218,20 @@ Arguments:
197218
198219
199220
200-
$ ./cli file edit
221+
```
222+
223+
### `$ ./cli file edit`
201224

225+
```shell
202226
missing required argument: PATH
203227
usage: cli file edit PATH
204228
205229
206-
$ ./cli file edit -h
230+
```
231+
232+
### `$ ./cli file edit -h`
207233

234+
```shell
208235
cli file edit - Edit the file
209236
210237
Usage:
@@ -221,8 +248,11 @@ Arguments:
221248
222249
223250
224-
$ ./cli file edit filename
251+
```
252+
253+
### `$ ./cli file edit filename`
225254

255+
```shell
226256
# this file is located in 'src/file_edit_command.sh'
227257
# code for 'cli file edit' goes here
228258
# you can edit it freely and regenerate (it will not be overwritten)

0 commit comments

Comments
 (0)