From 910e86b4b2baee430359d6da3b39cbd98d2f21fd Mon Sep 17 00:00:00 2001 From: Vladimir Zhelezov Date: Mon, 14 Dec 2020 08:10:16 +0100 Subject: [PATCH] Fix a7dc62d: set $subcommandOptions unconditionally --- shell-completion/hledger-completion.bash | 9 +++++---- shell-completion/hledger-completion.bash.m4 | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/shell-completion/hledger-completion.bash b/shell-completion/hledger-completion.bash index 00aa0222e..d6dc14502 100644 --- a/shell-completion/hledger-completion.bash +++ b/shell-completion/hledger-completion.bash @@ -41,11 +41,12 @@ _hledger_completion_function() { )" return 0 fi - if [[ $cur == -* ]]; then - # Replace dashes with underscores and use indirect expansion - subcommandOptions=_hledger_complist_options_${subcommand//-/_} - _hledger_compreply "$(_hledger_compgen "${!subcommandOptions}")" + # Replace dashes with underscores and use indirect expansion + subcommandOptions=_hledger_complist_options_${subcommand//-/_} + + if [[ $cur == -* ]]; then + _hledger_compreply "$(_hledger_compgen "${!subcommandOptions}")" # Suspend space on completion of long options requiring an argument [[ ${COMPREPLY[0]} == --*= ]] && compopt -o nospace diff --git a/shell-completion/hledger-completion.bash.m4 b/shell-completion/hledger-completion.bash.m4 index cf6749c6d..bb1499867 100644 --- a/shell-completion/hledger-completion.bash.m4 +++ b/shell-completion/hledger-completion.bash.m4 @@ -41,11 +41,12 @@ _hledger_completion_function() { )" return 0 fi - if [[ $cur == -* ]]; then - # Replace dashes with underscores and use indirect expansion - subcommandOptions=_hledger_complist_options_${subcommand//-/_} - _hledger_compreply "$(_hledger_compgen "${!subcommandOptions}")" + # Replace dashes with underscores and use indirect expansion + subcommandOptions=_hledger_complist_options_${subcommand//-/_} + + if [[ $cur == -* ]]; then + _hledger_compreply "$(_hledger_compgen "${!subcommandOptions}")" # Suspend space on completion of long options requiring an argument [[ ${COMPREPLY[0]} == --*= ]] && compopt -o nospace