diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-08-13 10:55:50 +0900 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-08-13 10:55:50 +0900 |
commit | 4fc6fee734e1b88c9aab94e66f5a2f908a86452f (patch) | |
tree | 76a2d79320ec2da88762d28ef66a391243206543 /commands/compose/abort.go | |
parent | f0a0c5aa733fa66958c113465bfc5fdd3d7cc9f0 (diff) | |
download | aerc-4fc6fee734e1b88c9aab94e66f5a2f908a86452f.tar.gz |
Revert "add close command at global level"
This reverts commit f0a0c5aa733fa66958c113465bfc5fdd3d7cc9f0.
Diffstat (limited to 'commands/compose/abort.go')
-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 00000000..4c121d72 --- /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 +} |