Skip to content

Commit 172a81e

Browse files
authored
Merge pull request #44 from bashly-framework/v1.3.3
Update `validate` with new array syntax
2 parents 6e3353f + 3fadf90 commit 172a81e

File tree

6 files changed

+28
-7
lines changed

6 files changed

+28
-7
lines changed

retype.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ editor:
1313
branding:
1414
logo: assets/logo.svg
1515
logoDark: assets/logo-dark.svg
16-
label: v1.3.2
16+
label: v1.3.3
1717

1818
meta:
1919
title: " - Bashly"

src/advanced/validations.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ order: 80
88
Bashly supports custom validation functions for your arguments, flag
99
arguments, and environment variables. This is how it works:
1010

11-
1. In your bashly configuration file, arguments and flags (with arguments)
12-
may have a `validate: function_name` option.
11+
1. In your bashly configuration file, arguments, flags (with arguments) and
12+
environment variables may have a `validate: function_name` option.
1313
2. Whenever you run your script, it will look for a function with that name,
1414
prefixed by `validate_` and will run it before allowing the user
1515
input to pass.
@@ -36,6 +36,11 @@ validate_file_exists() {
3636

3737
+++
3838

39+
!!!success Tip
40+
You may specify multiple validation functions by supplying an array:
41+
`validate: [file_exists, file_is_writable]`
42+
!!!
43+
3944

4045
## Built-in Custom Validations
4146

src/configuration/argument.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Non-unique values will be ignored.
120120

121121
### validate
122122

123-
[!badge String]
123+
[!badge String / Array of Strings]
124124

125125
Apply a custom validation function.
126126

src/configuration/environment-variable.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ with [`default`](#default) or [`required`](#required).
9393

9494
### validate
9595

96-
[!badge String]
96+
[!badge String / Array of Strings]
9797

9898
Apply a custom validation function.
9999

src/configuration/flag.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ specified.
219219

220220
### validate
221221

222-
[!badge String]
222+
[!badge String / Array of Strings]
223223

224224
Apply a custom validation function.
225225

src/usage/settings.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ Bashly will look for the settings file in one of these paths:
2525
- A file named `bashly-settings.yml` in the working directory.
2626
- A file named `settings.yml` in the working directory.
2727

28+
### Environment Overrides
29+
30+
All options in the settings file (except `env`) may be specified with an
31+
environment suffix in order to override its value for a given environment
32+
(`production` or `development`).
33+
34+
For example, when defining `formatter_production: shfmt --minify`, then
35+
this will be the formatter used when generating the script with
36+
`bashly generate --env production`.
37+
38+
Since these values take precedence over the standard values, you can define
39+
both (i.e. `formatter: shfmt` and `formatter_production: shfmt --minify`).
40+
41+
2842
!!!success YAML Tips
2943
- The words `yes` and `no` are equivalent to `true` and `false`
3044
- To specify a `null` value, use `~`
@@ -36,13 +50,15 @@ Bashly will look for the settings file in one of these paths:
3650

3751
All settings are optional (with their default values provided below), and
3852
can also be set with an environment variable with the same name, capitalized
39-
and prefixed by `BASHLY_` - for example: `BASHLY_SOURCE_DIR`
53+
and prefixed by `BASHLY_` - for example: `BASHLY_SOURCE_DIR` environment
54+
variable is the same as specifying `source_dir` in the settings file.
4055

4156
When setting environment variables, you can use:
4257

4358
- `0`, `false` or `no` to represent false
4459
- `1`, `true` or `yes` to represent true
4560

61+
4662
## Path Options
4763

4864
### `source_dir`

0 commit comments

Comments
 (0)