You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -133,147 +133,59 @@ The `bashly.yml` configuration file consists of these types:
133
133
Unless otherwise specified, these definitiona can be used for both the root
134
134
command and subcommands (under the `commands` definition).
135
135
136
-
```yaml
137
-
# The name of the script or subcommand
138
-
name: myscript
139
-
140
-
# An additional, optional pattern - usually used to denote a one letter
141
-
# variation of the command name.
142
-
# You can add '*' as suffix, to denote a "starts with" pattern.
143
-
# Applicable only in subcommands
144
-
short: m*
145
-
146
-
# The header text to display when using --help
147
-
# This can have multiple lines. In this case, the first line will be used as
148
-
# summary wherever appropriate.
149
-
help: a sample script generated with bashly
150
-
151
-
# The string to display when using --version
152
-
# Applicable only in the main command
153
-
version: 0.1.0
154
-
155
-
# Specify an array of examples to show when using --help
156
-
# Each example can have multiple lines.
157
-
examples:
158
-
- myscript download
159
-
- myscript download --force
160
-
161
-
# Specify an array of environment variables needed by your script.
162
-
environment_variables:
163
-
- ... see below ...
164
-
165
-
# Specify the array of subcommands to generate.
166
-
# Each subcommand will have its own args and flags.
167
-
# If this is provided, you cannot specify flags or args.
168
-
commands:
169
-
- ...
170
-
171
-
# Specify the array of positional arguments this script needs.
172
-
# If this is provided, then you cannot specify commands.
173
-
args:
174
-
- ... see below ...
175
-
176
-
# Specify the array of option flags this script needs.
177
-
# If this is provided, then you cannot specify commands.
178
-
flags:
179
-
- ... see below ...
180
-
181
-
# Specify an array of any required external dependencies (commands).
182
-
# The script execution will be halted with a friendly error unless all
183
-
# dependency commands exist.
184
-
dependencies:
185
-
- curl
186
-
```
187
136
137
+
Option | Description
138
+
-----------|-------------
139
+
`name` | The name of the script or subcommand.
140
+
`short` | An additional, optional pattern - usually used to denote a one letter variation of the command name. You can add `*` as a suffix, to denote a "starts with" pattern - for example `short: m*`. *Applicable only in subcommands*.
141
+
`help` | The header text to display when using `--help`. This option can have multiple lines. In this case, the first line will be used as summary wherever appropriate.
142
+
`version` | The string to display when using `--version`. *Applicable only in the main command*.
143
+
`default` | Setting this to `yes` on any subcommand, will make unrecognized command line arguments to be passed to this command. *Applicable only in subcommands*.
144
+
`examples` | Specify an array of examples to show when using `--help`. Each example can have multiple lines.
145
+
`environment_variables` | Specify an array of environment variables needed by your script.
146
+
`commands` | Specify the array of subcommands. Each subcommand will have its own args and flags. Note: if `commands` is provided, you cannot specify flags or args at the same level.
147
+
`args` | Specify the array of positional arguments this script needs.
148
+
`flags` | Specify the array of option flags this script needs.
149
+
`dependencies` | Specify an array of any required external dependencies (commands). The script execution will be halted with a friendly error unless all dependency commands exist.
188
150
189
151
### Argument options
190
152
191
-
The below configuration generates this argument:
192
-
193
-
```
194
-
Usage:
195
-
myscript USER
196
-
197
-
Arguments:
198
-
USER
199
-
Username to use for logging in
200
-
```
201
-
202
153
The argument's value will be available to you as `${args[user]}` in your
203
154
bash function.
204
155
205
-
```yaml
206
-
# The name of the argument.
207
-
name: user
208
-
209
-
# The message to display when using --help.
210
-
# This can have multiple lines.
211
-
help: Username to use for logging in
212
-
213
-
# Specify if this argument is required.
214
-
# Note that once you define an optional argument (without required: true)
215
-
# then you cannot define required arguments after it.
216
-
required: true
217
-
```
156
+
Option | Description
157
+
-----------|-------------
158
+
`name` | The name of the argument.
159
+
`help` | The message to display when using `--help`. Can have multiple lines.
160
+
`required` | Specify if this argument is required. Note that once you define an optional argument (without required: true) then you cannot define required arguments after it.
218
161
219
162
### Flag options
220
163
221
-
The below configuration generates this flag:
222
-
223
-
```
224
-
Options:
225
-
-o, --output DIRECTORY (required)
226
-
Specify the output directory
227
-
```
228
-
229
164
The flag's value will be available to you as `${args[--output]}` in your
230
165
bash function (regardless of whether the user provided ut with the long or
231
166
short form).
232
167
233
-
```yaml
234
-
# The long form of the flag.
235
-
long: --output
236
-
237
-
# The short form of the flag.
238
-
short: -o
239
-
240
-
# The text to display when using --help
241
-
# This can have multiple lines.
242
-
help: Specify the output directory
243
-
244
-
# If the flag requires an argument, specify its name here.
245
-
arg: directory
246
-
247
-
# Specify if this flag is required.
248
-
required: true
249
-
```
168
+
Option | Description
169
+
-----------|-------------
170
+
`long` | The long form of the flag.
171
+
`short` | The short form of the flag.
172
+
`help` | The text to display when using `--help`. Can have multiple lines.
173
+
`arg` | If the flag requires an argument, specify its name here.
174
+
`required` | Specify if this flag is required.
250
175
251
176
### Environment Variable options
252
177
253
178
The below configuration generates this environment variable usage text:
254
179
255
-
```
256
-
Environment Variables:
257
-
SECRET_KEY (required)
258
-
Your API secret key
259
-
```
260
-
261
180
If an environment variable is defined as required (false by default), the
262
181
execution of the script will be halted with a friendly error if it is not
263
182
set.
264
183
265
-
```yaml
266
-
# The name of the variable (it will be automatically capitalized).
267
-
name: secret_key
268
-
269
-
# The message to display when using --help.
270
-
# This can have multiple lines.
271
-
help: Your API secret key
272
-
273
-
# Specify if this variable is required.
274
-
required: true
275
-
```
276
-
184
+
Option | Description
185
+
-----------|-------------
186
+
`name` | The name of the variable (it will be automatically capitalized).
187
+
`help` | The message to display when using --help. Can have multiple lines.
188
+
`required` | Specify if this variable is required.
0 commit comments