diff options
Diffstat (limited to 'commands/prompt.go')
-rw-r--r-- | commands/prompt.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/commands/prompt.go b/commands/prompt.go new file mode 100644 index 00000000..37348813 --- /dev/null +++ b/commands/prompt.go @@ -0,0 +1,33 @@ +package commands + +import ( + "errors" + "fmt" + + "git.sr.ht/~sircmpwn/aerc/widgets" +) + +type Prompt struct{} + +func init() { + register(Prompt{}) +} + +func (_ Prompt) Aliases() []string { + return []string{"prompt"} +} + +func (_ Prompt) Complete(aerc *widgets.Aerc, args []string) []string { + return nil // TODO: add completions +} + +func (_ Prompt) Execute(aerc *widgets.Aerc, args []string) error { + if len(args) < 3 { + return errors.New(fmt.Sprintf("Usage: %s <prompt> <cmd>", args[0])) + } + + prompt := args[1] + cmd := args[2:] + aerc.RegisterPrompt(prompt, cmd) + return nil +} |