diff options
author | Gregory Mullen <greg@cmdline.org> | 2019-06-27 10:33:11 -0700 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-06-29 14:24:19 -0400 |
commit | 2a0961701c4cabecc53d134ed1782e5612e64580 (patch) | |
tree | 57952ac82fb7104113ca7fc0e25dc3d225f77ea7 /commands/next-tab.go | |
parent | 177651bddab145c8a56cdfeb0d57b5fd95a6d0e2 (diff) |
Implement basic tab completion support
Tab completion currently only works on commands. Contextual completion
will be added in the future.
Diffstat (limited to 'commands/next-tab.go')
-rw-r--r-- | commands/next-tab.go | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/commands/next-tab.go b/commands/next-tab.go index fb5b664..aa6e1dc 100644 --- a/commands/next-tab.go +++ b/commands/next-tab.go @@ -8,16 +8,21 @@ import ( "git.sr.ht/~sircmpwn/aerc/widgets" ) +type NextPrevTab struct{} + func init() { - register("next-tab", NextPrevTab) - register("prev-tab", NextPrevTab) + register(NextPrevTab{}) } -func nextPrevTabUsage(cmd string) error { - return errors.New(fmt.Sprintf("Usage: %s [n]", cmd)) +func (_ NextPrevTab) Aliases() []string { + return []string{"next-tab", "prev-tab"} +} + +func (_ NextPrevTab) Complete(aerc *widgets.Aerc, args []string) []string { + return nil } -func NextPrevTab(aerc *widgets.Aerc, args []string) error { +func (_ NextPrevTab) Execute(aerc *widgets.Aerc, args []string) error { if len(args) > 2 { return nextPrevTabUsage(args[0]) } @@ -40,3 +45,7 @@ func NextPrevTab(aerc *widgets.Aerc, args []string) error { } return nil } + +func nextPrevTabUsage(cmd string) error { + return errors.New(fmt.Sprintf("Usage: %s [n]", cmd)) +} |