Skip to content

Commit 13af4c5

Browse files
committed
regenerate example output
1 parent c9a239b commit 13af4c5

File tree

4 files changed

+145
-6
lines changed

4 files changed

+145
-6
lines changed

examples/colors/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,18 @@ echo
6666
6767
```
6868

69+
### `$ NO_COLOR=1 ./colorly`
70+
71+
```shell
72+
Message Recevied:
73+
74+
=> hello colors
75+
==> hello colors
76+
===> hello colors
77+
78+
79+
80+
```
81+
6982

7083

examples/command-private/README.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,129 @@ $ bashly generate
1313
<!-- include: src/connect_command.sh -->
1414

1515
-----
16+
17+
## `bashly.yml`
18+
19+
```yaml
20+
name: cli
21+
help: Sample application with private commands
22+
version: 0.1.0
23+
24+
commands:
25+
- name: connect
26+
short: c
27+
help: Connect to the metaverse
28+
29+
args:
30+
- name: protocol
31+
required: true
32+
allowed: [ftp, ssh]
33+
help: Protocol to use for connection
34+
35+
# These two commands will be hidden from the commands list, but still executable
36+
# and visible when running 'cli connect-ftp --help' or 'cli connect-ssh --help'
37+
- name: connect-ftp
38+
help: Connect via FTP
39+
private: true
40+
41+
- name: connect-ssh
42+
help: Connect via SSH
43+
private: true
44+
```
45+
46+
## `src/connect_command.sh`
47+
48+
```bash
49+
# Execute a subsequent (private) command based on the PROTOCOL argument
50+
protocol=${args[protocol]}
51+
cmd="./cli connect-$protocol"
52+
echo "=== Calling $cmd"
53+
$cmd
54+
```
55+
56+
57+
## Generated script output
58+
59+
### `$ ./cli`
60+
61+
```shell
62+
cli - Sample application with private commands
63+
64+
Usage:
65+
cli [command]
66+
cli [command] --help | -h
67+
cli --version | -v
68+
69+
Commands:
70+
connect Connect to the metaverse
71+
72+
73+
74+
```
75+
76+
### `$ ./cli -h`
77+
78+
```shell
79+
cli - Sample application with private commands
80+
81+
Usage:
82+
cli [command]
83+
cli [command] --help | -h
84+
cli --version | -v
85+
86+
Commands:
87+
connect Connect to the metaverse
88+
89+
Options:
90+
--help, -h
91+
Show this help
92+
93+
--version, -v
94+
Show version number
95+
96+
97+
98+
```
99+
100+
### `$ ./cli connect ftp`
101+
102+
```shell
103+
=== Calling ./cli connect-ftp
104+
# this file is located in 'src/connect_ftp_command.sh'
105+
# code for 'cli connect-ftp' goes here
106+
# you can edit it freely and regenerate (it will not be overwritten)
107+
args: none
108+
109+
110+
```
111+
112+
### `$ ./cli connect-ssh`
113+
114+
```shell
115+
# this file is located in 'src/connect_ssh_command.sh'
116+
# code for 'cli connect-ssh' goes here
117+
# you can edit it freely and regenerate (it will not be overwritten)
118+
args: none
119+
120+
121+
```
122+
123+
### `$ ./cli connect-ftp --help`
124+
125+
```shell
126+
cli connect-ftp - Connect via FTP
127+
128+
Usage:
129+
cli connect-ftp
130+
cli connect-ftp --help | -h
131+
132+
Options:
133+
--help, -h
134+
Show this help
135+
136+
137+
138+
```
139+
140+
141+

examples/environment-variables/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ echo "# you can edit it freely and regenerate (it will not be overwritten)"
6060
inspect_args
6161
6262
echo "environment:"
63-
echo "- API_KEY=$API_KEY"
64-
echo "- ENVIRONMENT=$ENVIRONMENT"
65-
echo "- MY_SECRET=$MY_SECRET"
63+
echo "- API_KEY=${API_KEY:-}"
64+
echo "- ENVIRONMENT=${ENVIRONMENT:-}"
65+
echo "- MY_SECRET=${MY_SECRET:-}"
6666
6767
```
6868

examples/yaml/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ server:
6464
## `src/root_command.sh`
6565

6666
```bash
67-
filename=${args[filename]}
68-
variable=${args[variable]}
69-
prefix=${args[--prefix]}
67+
filename=${args[filename]:-}
68+
variable=${args[variable]:-}
69+
prefix=${args[--prefix]:-}
7070
7171
if [[ $variable ]]; then
7272
eval "$(yaml_load "$filename" "$prefix")"

0 commit comments

Comments
 (0)