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:
parent
c139bb24a7
commit
57c79d0050
@ -32,7 +32,7 @@ _hledger_completion_function() {
|
|||||||
# $subcommand == reg --> register, register-match,
|
# $subcommand == reg --> register, register-match,
|
||||||
# $subcommand == bal --> balance, balancesheet, balancesheetequity, etc.
|
# $subcommand == bal --> balance, balancesheet, balancesheetequity, etc.
|
||||||
# Do not ignore them!
|
# Do not ignore them!
|
||||||
if [[ $subcommand == "$cur" ]] && ((i == cword)); then
|
if ((i == cword)); then
|
||||||
local subcommandMatches
|
local subcommandMatches
|
||||||
subcommandMatches=$(grep -c "^$subcommand" <<< "$_hledger_complist_commands")
|
subcommandMatches=$(grep -c "^$subcommand" <<< "$_hledger_complist_commands")
|
||||||
if ((subcommandMatches > 1)); then
|
if ((subcommandMatches > 1)); then
|
||||||
|
|||||||
@ -32,7 +32,7 @@ _hledger_completion_function() {
|
|||||||
# $subcommand == reg --> register, register-match,
|
# $subcommand == reg --> register, register-match,
|
||||||
# $subcommand == bal --> balance, balancesheet, balancesheetequity, etc.
|
# $subcommand == bal --> balance, balancesheet, balancesheetequity, etc.
|
||||||
# Do not ignore them!
|
# Do not ignore them!
|
||||||
if [[ $subcommand == "$cur" ]] && ((i == cword)); then
|
if ((i == cword)); then
|
||||||
local subcommandMatches
|
local subcommandMatches
|
||||||
subcommandMatches=$(grep -c "^$subcommand" <<< "$_hledger_complist_commands")
|
subcommandMatches=$(grep -c "^$subcommand" <<< "$_hledger_complist_commands")
|
||||||
if ((subcommandMatches > 1)); then
|
if ((subcommandMatches > 1)); then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user