diff options
Diffstat (limited to 'commands/compose')
-rw-r--r-- | commands/compose/abort.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/commands/compose/abort.go b/commands/compose/abort.go new file mode 100644 index 0000000..4c121d7 --- /dev/null +++ b/commands/compose/abort.go @@ -0,0 +1,33 @@ +package compose + +import ( + "errors" + + "git.sr.ht/~sircmpwn/aerc/widgets" +) + +type Abort struct{} + +func init() { + register(Abort{}) +} + +func (_ Abort) Aliases() []string { + return []string{"abort"} +} + +func (_ Abort) Complete(aerc *widgets.Aerc, args []string) []string { + return nil +} + +func (_ Abort) Execute(aerc *widgets.Aerc, args []string) error { + if len(args) != 1 { + return errors.New("Usage: abort") + } + composer, _ := aerc.SelectedTab().(*widgets.Composer) + + aerc.RemoveTab(composer) + composer.Close() + + return nil +} |