Skip to content

Commit 88ae8b3

Browse files
committed
fix shellcheck
1 parent ef95fbe commit 88ae8b3

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

lib/bashly/views/flag/case.erb

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
# :flag.case
22
<%= aliases.join " | " %> )
3-
% if conflicts
4-
for conflicts in <%= conflicts.join ' ' %>; do
5-
if [[ -n "${args[$conflicts]:-}" ]]; then
6-
printf "<%= strings[:conflicting_flags] %>\n" "$key" "$conflicts"
7-
exit 1
8-
fi
9-
done
10-
11-
% end
3+
<%= render(:conflicts).indent 2 %>
124
% if arg
135
if [[ -n ${2+x} ]]; then
146
<%= render(:validations).indent 4 %>

lib/bashly/views/flag/conflicts.erb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# :flag.conflicts
2+
% if conflicts
3+
% if conflicts.count == 1
4+
if [[ -n "${args[<%= conflicts.first %>]:-}" ]]; then
5+
printf "<%= strings[:conflicting_flags] %>\n" "$key" "<%= conflicts.first %>"
6+
exit 1
7+
fi
8+
9+
% else
10+
for conflict in <%= conflicts.join ' ' %>; do
11+
if [[ -n "${args[$conflict]:-}" ]]; then
12+
printf "<%= strings[:conflicting_flags] %>\n" "$key" "$conflict"
13+
exit 1
14+
fi
15+
done
16+
17+
% end
18+
% end

0 commit comments

Comments
 (0)