Skip to content

Commit d359a6f

Browse files
authored
Merge pull request #36 from DannyBen/1.2.7
1.2.7
2 parents 04163a1 + ca1a4d8 commit d359a6f

File tree

3 files changed

+146
-37
lines changed

3 files changed

+146
-37
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.2.6
16+
label: v1.2.7
1717

1818
meta:
1919
title: " | Bashly - Bash Command Line Framework"

src/usage/settings.md

Lines changed: 139 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ When setting environment variables, you can use:
4343
- `0`, `false` or `no` to represent false
4444
- `1`, `true` or `yes` to represent true
4545

46-
## Options
46+
## Path Options
4747

4848
### `source_dir`
4949

@@ -104,6 +104,20 @@ recommended to enable this by setting it to something like
104104

105105
[!button variant="primary" icon="code-review" text="Command Paths Example"](https://github.com/DannyBen/bashly/tree/master/examples/command-paths#readme)
106106

107+
### `partials_extension`
108+
109+
```yaml
110+
# default
111+
partials_extension: sh
112+
113+
# example
114+
partials_extension: bash
115+
```
116+
117+
Set the extension to use when reading/writing partial script snippets.
118+
119+
## Format Options
120+
107121
### `strict`
108122

109123
```yaml
@@ -137,6 +151,8 @@ Specify the indentation style of the generated script.
137151
- `tab_indent: true` - Indent with Tab (every 2 leading spaces will be converted
138152
to a tab character).
139153

154+
## Interface Options
155+
140156
### `compact_short_flags`
141157

142158
```yaml
@@ -162,38 +178,6 @@ or `-f=value`
162178
- `conjoined_flag_args: true` - Expand `--flag=value` to `--flag value` and `-f=value` to `-f value`.
163179
- `conjoined_flag_args: false` - Do not expand `--flag=value` or `-f=value` (consider this an invalid input).
164180

165-
### `env`
166-
167-
```yaml
168-
# default
169-
env: development
170-
```
171-
172-
Specify if the generated script should include development related comments and
173-
functions or not.
174-
175-
- `env: development` - Generate with file markers and development functions, such as `inspect_args()`.
176-
- `env: production` - Generate a smaller script, without file markers and development functions.
177-
178-
!!!success File Markers
179-
File markers are special comments that are injected to the final script and
180-
specify the name of the internal bashly template (view) or the path to the
181-
user's partial code files.
182-
!!!
183-
184-
### `partials_extension`
185-
186-
```yaml
187-
# default
188-
partials_extension: sh
189-
190-
# example
191-
partials_extension: bash
192-
```
193-
194-
Set the extension to use when reading/writing partial script snippets.
195-
196-
197181
### `show_examples_on_error`
198182

199183
```yaml
@@ -207,7 +191,6 @@ provide the required arguments.
207191

208192
[!button variant="primary" icon="code-review" text="Show Examples on Error Example"](https://github.com/DannyBen/bashly/tree/master/examples/command-examples-on-error#readme)
209193

210-
211194
### `private_reveal_key`
212195

213196
```yaml
@@ -224,7 +207,6 @@ all the private elements in the usage texts, as if they were public.
224207

225208
[!button variant="primary" icon="code-review" text="Private Reveal Example"](https://github.com/DannyBen/bashly/tree/master/examples/private-reveal#readme)
226209

227-
228210
### `usage_colors`
229211

230212
```yaml
@@ -256,3 +238,125 @@ This option cannot be set using environment variables.
256238
!!!
257239

258240
[!button variant="primary" icon="code-review" text="Usage Colors Example"](https://github.com/DannyBen/bashly/tree/master/examples/colors-usage#readme)
241+
242+
## Feature Toggles
243+
244+
### `env`
245+
246+
```yaml
247+
# default
248+
env: development
249+
```
250+
251+
Specify one of two script rendering environments:
252+
253+
- `env: development` - Generate a script suitable for development, which is usually slightly larger
254+
and contains additional development-specific features.
255+
- `env: production` - Generate a script suitable for distribution, which is usually smaller.
256+
257+
Use the `enable_*` options below to adjust settings for each environment.
258+
259+
!!! Note
260+
It is recommended to leave this set to `development` in the settings file, and
261+
use either the `BASHLY_ENV` environment variable or the
262+
`bashly generate --production` command when the slimmer production script is needed.
263+
!!!
264+
265+
266+
### `enable_header_comment`
267+
268+
```yaml
269+
# default (allowed: always, never, development, production)
270+
enable_header_comment: always
271+
```
272+
273+
Specify if you wish to render the "do not modify" comment at the beginning of
274+
the script.
275+
276+
### `enable_bash3_bouncer`
277+
278+
```yaml
279+
# default (allowed: always, never, development, production)
280+
enable_bash3_bouncer: always
281+
```
282+
283+
Specify if you wish to render the piece of code that aborts the script execution
284+
when bash version is < 4.
285+
286+
### `enable_view_markers`
287+
288+
```yaml
289+
# default (allowed: always, never, development, production)
290+
enable_view_markers: development
291+
```
292+
293+
Specify if you want the rendered script to include view marker comments.
294+
295+
View markers provide the name of the internal bashly template (view) or the
296+
path to the user's partial code files in the final script, to help locate
297+
the source file for each piece of code.
298+
299+
### `enable_inspect_args`
300+
301+
```yaml
302+
# default (allowed: always, never, development, production)
303+
enable_inspect_args: development
304+
```
305+
306+
Specify if you want the rendered script to include the `inspect_args()` function.
307+
308+
The `inspect_args()` function can help in reviewing the input for each command.
309+
310+
### `enable_deps_array`
311+
312+
```yaml
313+
# default (allowed: always, never, development, production)
314+
enable_deps_array: always
315+
```
316+
317+
Specify if you want to populate the `$deps` bash array.
318+
319+
This is applicable only if your script uses the
320+
[Dependency](/configuration/dependency) configuration option.
321+
322+
### `enable_env_var_names_array`
323+
324+
```yaml
325+
# default (allowed: always, never, development, production)
326+
enable_env_var_names_array: always
327+
```
328+
329+
Specify if you want to populate the `$env_var_names` bash array.
330+
331+
This is applicable only if your script uses the
332+
[Environment Variable](/configuration/environment-variable) configuration option.
333+
334+
## Scripting Options
335+
336+
### `var_aliases`
337+
338+
```yaml
339+
# default
340+
var_aliases:
341+
args: ~
342+
other_args: ~
343+
deps: ~
344+
env_var_names: ~
345+
346+
# example
347+
var_aliases:
348+
args: ARGS
349+
other_args: catch_all
350+
deps: dependencies
351+
env_var_names: ENV_VARS
352+
```
353+
354+
Update one or more of these options in case you wish to change the name of the
355+
public global array that bashly uses for storing data.
356+
357+
Note that this feature will not change the original name, but rather create
358+
an alias using `declare -gn`.
359+
360+
!!! Note
361+
This option cannot be set using environment variables.
362+
!!!

src/usage/writing-your-scripts.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Any code within the `src/initialize.sh` file will be called before anything else
105105
in your generated bash script.
106106

107107
!!!success Tip
108-
If your script defines [`Environment Variables`](/configuration/environment-variable)
108+
If your script defines [Environment Variables](/configuration/environment-variable)
109109
with [`default`](/configuration/environment-variable/#default) values, these
110110
values will be available to you in the `initialize.sh` file.
111111
!!!
@@ -128,6 +128,11 @@ Be sure to start your header with a shebang:
128128
`#!/usr/bin/env bash`{style="white-space: nowrap;"}
129129
!!!
130130

131+
!!!success Tip
132+
If you just want to remove the header comment, you can adjust the
133+
[`enable_header_comment`](/usage/settings/#enable_header_comment) setting instead.
134+
!!!
135+
131136
## Hidden comments
132137

133138
Any comment in your source files that begins with two `#` symbols, will be

0 commit comments

Comments
 (0)