Simplify sub-command loop logic
If the cursor is on the sub-command, just offer sub-command completions and be done with it. It was way over complicated.
This commit is contained in:
parent
f5d2a6bcc3
commit
046421e712
@ -36,15 +36,9 @@ _hledger_completion_function() {
|
||||
# $subcommand == bal --> balance, balancesheet, balancesheetequity, etc.
|
||||
# Do not ignore them!
|
||||
if ((i == cword)); then
|
||||
local subcommandMatches
|
||||
subcommandMatches=$(grep -c "^$subcommand" <<< "$_hledger_complist_commands")
|
||||
if ((subcommandMatches > 1)); then
|
||||
subcommand=
|
||||
break
|
||||
else
|
||||
_hledger_compreply "$subcommand"
|
||||
return 0
|
||||
fi
|
||||
compopt +o filenames
|
||||
_hledger_compreply "$(_hledger_compgen "$_hledger_complist_commands")"
|
||||
return 0
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
@ -36,15 +36,9 @@ _hledger_completion_function() {
|
||||
# $subcommand == bal --> balance, balancesheet, balancesheetequity, etc.
|
||||
# Do not ignore them!
|
||||
if ((i == cword)); then
|
||||
local subcommandMatches
|
||||
subcommandMatches=$(grep -c "^$subcommand" <<< "$_hledger_complist_commands")
|
||||
if ((subcommandMatches > 1)); then
|
||||
subcommand=
|
||||
break
|
||||
else
|
||||
_hledger_compreply "$subcommand"
|
||||
return 0
|
||||
fi
|
||||
compopt +o filenames
|
||||
_hledger_compreply "$(_hledger_compgen "$_hledger_complist_commands")"
|
||||
return 0
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
Loading…
Reference in New Issue
Block a user