summary refs log tree commit diff stats
path: root/commands/account/next-result.go
diff options
context:
space:
mode:
authorGregory Mullen <greg@cmdline.org>2019-06-27 10:33:11 -0700
committerDrew DeVault <sir@cmpwn.com>2019-06-29 14:24:19 -0400
commit2a0961701c4cabecc53d134ed1782e5612e64580 (patch)
tree57952ac82fb7104113ca7fc0e25dc3d225f77ea7 /commands/account/next-result.go
parent177651bddab145c8a56cdfeb0d57b5fd95a6d0e2 (diff)
downloadaerc-2a0961701c4cabecc53d134ed1782e5612e64580.tar.gz
Implement basic tab completion support
Tab completion currently only works on commands. Contextual completion
will be added in the future.
Diffstat (limited to 'commands/account/next-result.go')
-rw-r--r--commands/account/next-result.go19
1 files changed, 14 insertions, 5 deletions
diff --git a/commands/account/next-result.go b/commands/account/next-result.go
index d89de56..24d53be 100644
--- a/commands/account/next-result.go
+++ b/commands/account/next-result.go
@@ -7,16 +7,21 @@ import (
 	"git.sr.ht/~sircmpwn/aerc/widgets"
 )
 
+type NextPrevResult struct{}
+
 func init() {
-	register("next-result", NextPrevResult)
-	register("prev-result", NextPrevResult)
+	register(NextPrevResult{})
 }
 
-func nextPrevResultUsage(cmd string) error {
-	return errors.New(fmt.Sprintf("Usage: %s [<n>[%%]]", cmd))
+func (_ NextPrevResult) Aliases() []string {
+	return []string{"next-result", "prev-result"}
+}
+
+func (_ NextPrevResult) Complete(aerc *widgets.Aerc, args []string) []string {
+	return nil
 }
 
-func NextPrevResult(aerc *widgets.Aerc, args []string) error {
+func (_ NextPrevResult) Execute(aerc *widgets.Aerc, args []string) error {
 	if len(args) > 1 {
 		return nextPrevResultUsage(args[0])
 	}
@@ -39,3 +44,7 @@ func NextPrevResult(aerc *widgets.Aerc, args []string) error {
 	}
 	return nil
 }
+
+func nextPrevResultUsage(cmd string) error {
+	return errors.New(fmt.Sprintf("Usage: %s [<n>[%%]]", cmd))
+}