Add an early return from option argument completion

Do not even enter the case statement if preceding words don't look
like an option
This commit is contained in:
Vladimir Zhelezov 2020-12-13 08:24:16 +01:00
parent b6a4a887b9
commit eea7f0d506
2 changed files with 4 additions and 0 deletions

View File

@ -213,6 +213,8 @@ _hledger_compreply_optarg() {
optionIndex=$((cword - 2))
fi
[[ ${words[optionIndex]} == -* ]] || return
case ${words[optionIndex]} in
--alias)
compopt -o nospace

View File

@ -213,6 +213,8 @@ _hledger_compreply_optarg() {
optionIndex=$((cword - 2))
fi
[[ ${words[optionIndex]} == -* ]] || return
case ${words[optionIndex]} in
--alias)
compopt -o nospace