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/term.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'commands/term.go') diff --git a/commands/term.go b/commands/term.go index 3f70d67..8575019 100644 --- a/commands/term.go +++ b/commands/term.go @@ -10,11 +10,22 @@ import ( "github.com/riywo/loginshell" ) +type Term struct{} + func init() { - register("term", Term) + register(Term{}) +} + +func (_ Term) Aliases() []string { + return []string{"terminal", "term"} +} + +func (_ Term) Complete(aerc *widgets.Aerc, args []string) []string { + return nil } -func Term(aerc *widgets.Aerc, args []string) error { +// The help command is an alias for `term man` thus Term requires a simple func +func TermCore(aerc *widgets.Aerc, args []string) error { if len(args) == 1 { shell, err := loginshell.Shell() if err != nil { @@ -43,3 +54,7 @@ func Term(aerc *widgets.Aerc, args []string) error { } return nil } + +func (_ Term) Execute(aerc *widgets.Aerc, args []string) error { + return TermCore(aerc, args) +} -- cgit v1.2.3