Skip to content

Commit

Permalink
Auto merge of #13686 - scop:fix/cargo-unset-opt-var, r=ehuss
Browse files Browse the repository at this point in the history
fix: bash completion fallback in `nounset` mode

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
bors committed Apr 2, 2024
2 parents 631b077 + c1ffe80 commit 0a5cb89
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 0a5cb89

Please sign in to comment.