Skip to content

Commit c889cf6

Browse files
committed
fix(wtf): fix for missing optarg
In the original code, the existence of $1 was not checked after performing `shift`. This would cause an error when `set -o nounset` is set. This commit adds a check.
1 parent dc926e3 commit c889cf6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

completions/wtf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ _wtf()
2020
while (($# > 0)); do
2121
if [[ $1 == -f ]]; then
2222
shift
23-
db=$1
23+
if (($# > 0)); then
24+
db=$1
25+
fi
2426
break
2527
fi
2628
shift

0 commit comments

Comments
 (0)