Skip to content

Commit 783bcfd

Browse files
committed
remove -v test
1 parent d3ca7ab commit 783bcfd

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/bashly/views/command/catch_all_filter.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# :command.catch_all_filter
22
% if catch_all_required?
3-
if [[ ! -v other_args[@] ]]; then
3+
if [[ ${#other_args[@]} -eq 0 ]]; then
44
printf "<%= strings[:missing_required_argument] % { arg: catch_all_label, usage: usage_string } %>\n"
55
exit 1
66
fi

lib/bashly/views/command/inspect_args.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# :command.inspect_args
22
inspect_args() {
33
readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
4-
if [[ -v args[@] ]]; then
4+
if (( ${#args[@]} )); then
55
echo args:
66
for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
77
else
88
echo args: none
99
fi
1010

11-
if [[ -v other_args[@] ]]; then
11+
if (( ${#other_args[@]} )); then
1212
echo
1313
echo other_args:
1414
echo "- \${other_args[*]} = ${other_args[*]}"

lib/bashly/views/command/run.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# :command.run
22
run() {
3-
declare -A args
4-
declare -a other_args
5-
declare -a input
3+
declare -A args=()
4+
declare -a other_args=()
5+
declare -a input=()
66
normalize_input "$@"
77
parse_requirements "${input[@]}"
88

99
<%- condition = "if" -%>
1010
<%- deep_commands.each do |command| -%>
1111
<%= condition %> [[ $action == "<%= command.action_name %>" ]]; then
12-
if [[ -v args[--help] ]]; then
12+
if [[ ${args[--help]:-} ]]; then
1313
long_usage=yes
1414
<%= command.function_name %>_usage
1515
else

0 commit comments

Comments
 (0)