2019-08-20 01:56:12 +00:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"git.sr.ht/~sircmpwn/aerc/widgets"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Prompt struct{}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
register(Prompt{})
|
|
|
|
}
|
|
|
|
|
2019-09-03 19:34:03 +00:00
|
|
|
func (Prompt) Aliases() []string {
|
2019-08-20 01:56:12 +00:00
|
|
|
return []string{"prompt"}
|
|
|
|
}
|
|
|
|
|
2019-09-03 19:34:03 +00:00
|
|
|
func (Prompt) Complete(aerc *widgets.Aerc, args []string) []string {
|
2019-08-20 01:56:12 +00:00
|
|
|
return nil // TODO: add completions
|
|
|
|
}
|
|
|
|
|
2019-09-03 19:34:03 +00:00
|
|
|
func (Prompt) Execute(aerc *widgets.Aerc, args []string) error {
|
2019-08-20 01:56:12 +00:00
|
|
|
if len(args) < 3 {
|
2019-09-03 19:34:04 +00:00
|
|
|
return fmt.Errorf("Usage: %s <prompt> <cmd>", args[0])
|
2019-08-20 01:56:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
prompt := args[1]
|
|
|
|
cmd := args[2:]
|
|
|
|
aerc.RegisterPrompt(prompt, cmd)
|
|
|
|
return nil
|
|
|
|
}
|