aboutsummaryrefslogtreecommitdiffstats
path: root/commands/compose/attach-key.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/compose/attach-key.go')
-rw-r--r--commands/compose/attach-key.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/commands/compose/attach-key.go b/commands/compose/attach-key.go
new file mode 100644
index 00000000..c12df446
--- /dev/null
+++ b/commands/compose/attach-key.go
@@ -0,0 +1,32 @@
+package compose
+
+import (
+ "errors"
+
+ "git.sr.ht/~rjarry/aerc/widgets"
+)
+
+type AttachKey struct{}
+
+func init() {
+ register(AttachKey{})
+}
+
+func (AttachKey) Aliases() []string {
+ return []string{"attach-key"}
+}
+
+func (AttachKey) Complete(aerc *widgets.Aerc, args []string) []string {
+ return nil
+}
+
+func (AttachKey) Execute(aerc *widgets.Aerc, args []string) error {
+ if len(args) != 1 {
+ return errors.New("Usage: attach-key")
+ }
+
+ composer, _ := aerc.SelectedTab().(*widgets.Composer)
+
+ composer.SetAttachKey(!composer.AttachKey())
+ return nil
+}