Implement basic tab completion support

Tab completion currently only works on commands. Contextual completion
will be added in the future.
This commit is contained in:
Gregory Mullen 2019-06-27 10:33:11 -07:00 committed by Drew DeVault
parent 177651bdda
commit 2a0961701c
47 changed files with 598 additions and 154 deletions
commands/msgview

View file

@ -16,19 +16,31 @@ import (
"github.com/mitchellh/go-homedir"
)
type Save struct{}
func init() {
register("save", Save)
register(Save{})
}
func Save(aerc *widgets.Aerc, args []string) error {
func (_ Save) Aliases() []string {
return []string{"save"}
}
func (_ Save) Complete(aerc *widgets.Aerc, args []string) []string {
return nil
}
func (_ Save) Execute(aerc *widgets.Aerc, args []string) error {
opts, optind, err := getopt.Getopts(args, "p")
if err != nil {
return err
}
var (
mkdirs bool
path string
)
for _, opt := range opts {
switch opt.Option {
case 'p':