aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitaly Ovchinnikov <v@ovch.ru>2023-12-30 19:44:02 +0000
committerRobin Jarry <robin@jarry.cc>2023-12-31 11:56:25 +0100
commit90c44dab95a315d05e32a8f5e700b4ad8efdd38f (patch)
tree558fb40634ce534f28830827206447b69ed8a7ee
parent36f87135f56fe959b31118928d072a4a51993f22 (diff)
downloadaerc-90c44dab95a315d05e32a8f5e700b4ad8efdd38f.tar.gz
commands: fix abbreviations regression
Make commands abbreviations work again by fixing the mistake introduced in one of the recent commits. Fixes: 07c1cefcf62d ("patch: create sub-command structure") Signed-off-by: Vitaly Ovchinnikov <v@ovch.ru> Reviewed-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--main.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/main.go b/main.go
index f5194b6b..a7e2980d 100644
--- a/main.go
+++ b/main.go
@@ -77,11 +77,11 @@ func getCommands(selected ui.Drawable) []*commands.Commands {
// ar --> archive
// im --> import-mbox
func expandAbbreviations(name string, sets []*commands.Commands) (string, commands.Command) {
- var cmd commands.Command
- candidate := name
+ var candidateCmd commands.Command
+ candidateName := name
for _, set := range sets {
- cmd = set.ByName(name)
+ cmd := set.ByName(name)
if cmd != nil {
// Direct match, return it directly.
return name, cmd
@@ -91,7 +91,7 @@ func expandAbbreviations(name string, sets []*commands.Commands) (string, comman
if !strings.HasPrefix(n, name) {
continue
}
- if cmd != nil {
+ if candidateCmd != nil {
// We have more than one command partially
// matching the input. We can't expand such an
// abbreviation, so return the command as is so
@@ -99,11 +99,11 @@ func expandAbbreviations(name string, sets []*commands.Commands) (string, comman
return name, nil
}
// We have a partial match.
- candidate = n
- cmd = set.ByName(n)
+ candidateName = n
+ candidateCmd = set.ByName(n)
}
}
- return candidate, cmd
+ return candidateName, candidateCmd
}
func execCommand(