Skip to content

Commit

Permalink
fix: bash completion fallback in nounset mode
Browse files Browse the repository at this point in the history
With the shell in `nounset` mode, the intended fallback to filename
completion provokes an error:

```
$ cargo foo <TAB>bash: !opt_var: unbound variable
```
  • Loading branch information
scop committed Apr 1, 2024
1 parent 631b077 commit c1ffe80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/etc/cargo.bashcomp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ _cargo()
else
local opt_var=opt__${cmd//-/_}
fi
if [[ -z "${!opt_var}" ]]; then
if [[ -z "${!opt_var-}" ]]; then
# Fallback to filename completion.
_filedir
else
Expand Down

0 comments on commit c1ffe80

Please sign in to comment.