Simplify condition

Knowing the cursor position is enough to decide whether to complete
subcommand or not, and subcommand is already known.
This commit is contained in:
Vladimir Zhelezov 2020-12-11 10:11:43 +01:00
parent c139bb24a7
commit 57c79d0050
2 changed files with 2 additions and 2 deletions

View File

@ -32,7 +32,7 @@ _hledger_completion_function() {
# $subcommand == reg --> register, register-match,
# $subcommand == bal --> balance, balancesheet, balancesheetequity, etc.
# Do not ignore them!
if [[ $subcommand == "$cur" ]] && ((i == cword)); then
if ((i == cword)); then
local subcommandMatches
subcommandMatches=$(grep -c "^$subcommand" <<< "$_hledger_complist_commands")
if ((subcommandMatches > 1)); then

View File

@ -32,7 +32,7 @@ _hledger_completion_function() {
# $subcommand == reg --> register, register-match,
# $subcommand == bal --> balance, balancesheet, balancesheetequity, etc.
# Do not ignore them!
if [[ $subcommand == "$cur" ]] && ((i == cword)); then
if ((i == cword)); then
local subcommandMatches
subcommandMatches=$(grep -c "^$subcommand" <<< "$_hledger_complist_commands")
if ((subcommandMatches > 1)); then