blob: d791f7a9f1c86045ce1eb64fbc94b1f8b57d23cf (
plain) (
tree)
|
|
package commands
import (
"git.sr.ht/~rjarry/go-opt"
"git.sr.ht/~rjarry/aerc/app"
)
type Prompt struct {
Text string `opt:"text"`
Cmd []string `opt:"..." complete:"CompleteCommand"`
}
func init() {
register(Prompt{})
}
func (Prompt) Aliases() []string {
return []string{"prompt"}
}
func (*Prompt) CompleteCommand(arg string) []string {
return CompletionFromList(GlobalCommands.Names(), arg)
}
func (p Prompt) Execute(args []string) error {
cmd := opt.QuoteArgs(p.Cmd...)
app.RegisterPrompt(p.Text, cmd.String())
return nil
}
|