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
```
scop committed Apr 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
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
@@ -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

0 comments on commit c1ffe80

Please sign in to comment.