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