summary refs log tree commit diff stats
path: root/commands/compose/abort.go
diff options
context:
space:
mode:
authorCole Helbling <cole.e.helbling@gmail.com>2019-05-14 13:20:57 -0700
committerDrew DeVault <sir@cmpwn.com>2019-05-14 16:21:45 -0400
commitb0b3287bbdadad47757f3543a6560494af9175a8 (patch)
tree0c1ce33fb14bf31bd80acbece44b8a5d3378d465 /commands/compose/abort.go
parent2c486cb7f52ac5dd88f7445ca79726639e4a0084 (diff)
downloadaerc-b0b3287bbdadad47757f3543a6560494af9175a8.tar.gz
Implement abort command
This allows the user to close the compose tab without sending their
current composition.
Diffstat (limited to 'commands/compose/abort.go')
-rw-r--r--commands/compose/abort.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/commands/compose/abort.go b/commands/compose/abort.go
new file mode 100644
index 0000000..1cd297e
--- /dev/null
+++ b/commands/compose/abort.go
@@ -0,0 +1,23 @@
+package compose
+
+import (
+	"errors"
+
+	"git.sr.ht/~sircmpwn/aerc2/widgets"
+)
+
+func init() {
+	register("abort", CommandAbort)
+}
+
+func CommandAbort(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
+}
n163' href='#n163'>163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220