#
Settings
Some of bashly's commands can be tweaked through the use of environment variables, or a settings file.
#
Settings file
If you wish to load settings from a configuration file, you can generate an initial settings file by running:
$ bashly add settings
which will create the default settings.yml
file in the working directory.
Bashly will look for the settings file in one of these paths:
- A path set in the environment variable
BASHLY_SETTINGS_PATH
. - A file named
bashly-settings.yml
in the working directory. - A file named
settings.yml
in the working directory.
YAML Tips
- The words
yes
andno
are equivalent totrue
andfalse
- To specify a
null
value, use~
#
Environment variables
All settings are optional (with their default values provided below), and
can also be set with an environment variable with the same name, capitalized
and prefixed by BASHLY_
- for example: BASHLY_SOURCE_DIR
When setting environment variables, you can use:
0
,false
orno
to represent false1
,true
oryes
to represent true
#
Options
#
source_dir
source_dir: src
Set the path containing the bashly source files.
#
config_path
config_path: "%{source_dir}/bashly.yml"
Set the path to bashly.yml. You can use the special token %{source_dir}
to
reference the value of the source_dir
option.
#
target_dir
target_dir: .
Set the path to use for creating the final bash script.
#
lib_dir
lib_dir: lib
Set the path to use for common library files, relative to source_dir
.
#
commands_dir
commands_dir: ~
Set the path to use for command files, relative to source_dir
.
- When set to
nil
(denoted by~
), command files will be placed directly undersource_dir
. - When set to any other string, command files will be placed under this directory, and each command will get its own sub-directory.
In case you plan on creating a large script with many commands, it is
recommended to enable this by setting it to something like
commands_dir: commands
.
#
strict
strict: false
Specify which bash options to apply on initialization.
strict: true
- Bash strict mode (set -euo pipefail
)strict: false
- Only exit on errors (set -e
)strict: ''
- Do not add anyset
directivestrict: <string>
- Add any other customset
directive, for examplestrict: set -o pipefail
#
tab_indent
tab_indent: false
Specify the indentation style of the generated script.
tab_indent: false
- Indent with two spaces.tab_indent: true
- Indent with Tab (every 2 leading spaces will be converted to a tab character).
#
compact_short_flags
compact_short_flags: true
Specify how the generated script should treat flags in the form of -abc
compact_short_flags: true
- Expand-abc
to-a -b -c
.compact_short_flags: false
- Do not expand-abc
(consider this an invalid input).
#
env
env: development
Specify if the generated script should include development related comments and functions or not.
env: development
- Generate with file markers and development functions, such asinspect_args()
.env: production
- Generate a smaller script, without file markers and development functions.
File Markers
File markers are special comments that are injected to the final script and specify the name of the internal bashly template (view) or the path to the user's partial code files.
#
partials_extension
partials_extension: sh
Set the extension to use when reading/writing partial script snippets.
#
usage_colors
usage_colors:
caption: ~
command: ~
arg: ~
flag: ~
environment_variable: ~
Enable color output for several aspects of the help message of the generated
script. Each of these options may be a name of a color function that exists in
your script, for example: green
or bold
.
You can run bashly add colors
to add a standard colors library.
Note
This option cannot be set using environment variables.