diff --git a/lib/bashly/script/introspection/commands.rb b/lib/bashly/script/introspection/commands.rb index 299fd23a..419a8071 100644 --- a/lib/bashly/script/introspection/commands.rb +++ b/lib/bashly/script/introspection/commands.rb @@ -2,6 +2,10 @@ module Bashly module Script module Introspection module Commands + def catch_all_used_anywhere? + deep_commands(include_self: true).any? { |x| x.catch_all.enabled? } + end + # Returns a full list of the Command names and aliases combined def command_aliases commands.map(&:aliases).flatten diff --git a/lib/bashly/views/command/inspect_args.gtx b/lib/bashly/views/command/inspect_args.gtx index e9d52e99..0334d6a6 100644 --- a/lib/bashly/views/command/inspect_args.gtx +++ b/lib/bashly/views/command/inspect_args.gtx @@ -11,6 +11,8 @@ > echo args: none > fi > + +if catch_all_used_anywhere? > if ((${#other_args[@]})); then > echo > echo other_args: @@ -20,6 +22,8 @@ > done > fi > +end + if Settings.enabled? :deps_array > if ((${#deps[@]})); then > readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort) @@ -31,6 +35,7 @@ if Settings.enabled? :deps_array > fi > end + if Settings.enabled? :env_var_names_array > if ((${#env_var_names[@]})); then > readarray -t sorted_names < <(printf '%s\n' "${env_var_names[@]}" | sort) diff --git a/lib/bashly/views/command/run.gtx b/lib/bashly/views/command/run.gtx index ed487c77..598a1406 100644 --- a/lib/bashly/views/command/run.gtx +++ b/lib/bashly/views/command/run.gtx @@ -2,10 +2,10 @@ > run() { > declare -g -A args=() -unless Settings.enabled? :inspect_args - > # shellcheck disable=SC2034 + +if catch_all_used_anywhere? + > declare -g -a other_args=() end -> declare -g -a other_args=() if Settings.enabled? :deps_array > declare -g -A deps=()