From 2a0961701c4cabecc53d134ed1782e5612e64580 Mon Sep 17 00:00:00 2001 From: Gregory Mullen Date: Thu, 27 Jun 2019 10:33:11 -0700 Subject: Implement basic tab completion support Tab completion currently only works on commands. Contextual completion will be added in the future. --- commands/msgview/next-part.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'commands/msgview/next-part.go') diff --git a/commands/msgview/next-part.go b/commands/msgview/next-part.go index fcf8f19..8f25e02 100644 --- a/commands/msgview/next-part.go +++ b/commands/msgview/next-part.go @@ -8,16 +8,21 @@ import ( "git.sr.ht/~sircmpwn/aerc/widgets" ) +type NextPrevPart struct{} + func init() { - register("next-part", NextPrevPart) - register("prev-part", NextPrevPart) + register(NextPrevPart{}) } -func nextPrevPartUsage(cmd string) error { - return errors.New(fmt.Sprintf("Usage: %s [n]", cmd)) +func (_ NextPrevPart) Aliases() []string { + return []string{"next-part", "prev-part"} +} + +func (_ NextPrevPart) Complete(aerc *widgets.Aerc, args []string) []string { + return nil } -func NextPrevPart(aerc *widgets.Aerc, args []string) error { +func (_ NextPrevPart) Execute(aerc *widgets.Aerc, args []string) error { if len(args) > 2 { return nextPrevPartUsage(args[0]) } @@ -41,3 +46,7 @@ func NextPrevPart(aerc *widgets.Aerc, args []string) error { } return nil } + +func nextPrevPartUsage(cmd string) error { + return errors.New(fmt.Sprintf("Usage: %s [n]", cmd)) +} -- cgit v1.2.3