File tree 3 files changed +21
-2
lines changed
3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,11 @@ module Bashly
2
2
module Script
3
3
module Introspection
4
4
module Commands
5
+ # Returns true if the command or any of its descendants has `catch_all`
6
+ def catch_all_used_anywhere?
7
+ deep_commands ( include_self : true ) . any? { |x | x . catch_all . enabled? }
8
+ end
9
+
5
10
# Returns a full list of the Command names and aliases combined
6
11
def command_aliases
7
12
commands . map ( &:aliases ) . flatten
Original file line number Diff line number Diff line change 11
11
> echo args: none
12
12
> fi
13
13
>
14
+
15
+ if catch_all_used_anywhere?
14
16
> if ((${#other_args[@]})); then
15
17
> echo
16
18
> echo other_args:
20
22
> done
21
23
> fi
22
24
>
25
+ end
26
+
23
27
if Settings.enabled? :deps_array
24
28
> if ((${#deps[@]})); then
25
29
> readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort)
@@ -31,6 +35,7 @@ if Settings.enabled? :deps_array
31
35
> fi
32
36
>
33
37
end
38
+
34
39
if Settings.enabled? :env_var_names_array
35
40
> if ((${#env_var_names[@]})); then
36
41
> readarray -t sorted_names < <(printf '%s\n' "${env_var_names[@]}" | sort)
Original file line number Diff line number Diff line change 2
2
3
3
> run() {
4
4
> declare -g -A args=()
5
+
6
+ if catch_all_used_anywhere?
7
+ > declare -g -a other_args=()
8
+ end
9
+
5
10
if Settings.enabled? :deps_array
6
11
> declare -g -A deps=()
7
12
end
8
- > declare -g -a other_args=()
13
+
9
14
if Settings.enabled? :env_var_names_array
10
15
> declare -g -a env_var_names=()
11
16
end
17
+
12
18
> declare -g -a input=()
19
+
13
20
if has_unique_args_or_flags?
14
21
> declare -g -A unique_lookup=()
15
22
end
23
+
16
24
> normalize_input "$@"
17
25
> parse_requirements "${input[@]}"
26
+
18
27
if user_file_exist?('before')
19
28
> before_hook
20
29
end
30
+
21
31
>
22
32
> case "$action" in
23
-
24
33
deep_commands.each do |command|
25
34
> "{{ command.action_name }}") {{ command.function_name }}_command ;;
26
35
end
You can’t perform that action at this time.
0 commit comments