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/term.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/term.go')
-rw-r--r-- | commands/term.go | 19 |
1 files changed, 17 insertions, 2 deletions
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) +} |