Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/bashly/libraries/settings/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,18 @@ enable_view_markers: development
enable_inspect_args: development
enable_deps_array: always
enable_env_var_names_array: always


#-------------------------------------------------------------------------------
# SCRIPTING OPTIONS
#-------------------------------------------------------------------------------

# These are the public global variables available for use in your partial
# scripts. Adding a new name here will create a reference variable using
# `declare -gn`, allowing you to access the original variable under the new
# name in addition to its original name.
var_aliases:
args: ~
other_args: ~
deps: ~
env_var_names: ~
7 changes: 6 additions & 1 deletion lib/bashly/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class << self
:strict,
:tab_indent,
:target_dir,
:usage_colors
:usage_colors,
:var_aliases
)

def commands_dir
Expand Down Expand Up @@ -133,6 +134,10 @@ def usage_colors
@usage_colors ||= get :usage_colors
end

def var_aliases
@var_aliases ||= get :var_aliases
end

private

def get(key)
Expand Down
7 changes: 7 additions & 0 deletions lib/bashly/views/command/run.gtx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ if has_unique_args_or_flags?
> declare -g -A unique_lookup=()
end

>
Settings.var_aliases.each do |original, refname|
if refname
> declare -gn {{ refname }}={{ original }}
end
end
>
> normalize_input "$@"
> parse_requirements "${input[@]}"

Expand Down
Loading