about summary refs log tree commit diff stats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/compose/cc-bcc.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/commands/compose/cc-bcc.go b/commands/compose/cc-bcc.go
new file mode 100644
index 0000000..7bc1f5d
--- /dev/null
+++ b/commands/compose/cc-bcc.go
@@ -0,0 +1,39 @@
+package compose
+
+import (
+	"fmt"
+	"strings"
+
+	"git.sr.ht/~sircmpwn/aerc/widgets"
+)
+
+type CC struct{}
+
+func init() {
+	register(CC{})
+}
+
+func (_ CC) Aliases() []string {
+	return []string{"cc", "bcc"}
+}
+
+func (_ CC) Complete(aerc *widgets.Aerc, args []string) []string {
+	return nil
+}
+
+func (_ CC) Execute(aerc *widgets.Aerc, args []string) error {
+	if len(args) < 2 {
+		return fmt.Errorf("Usage: %s <addresses>", args[0])
+	}
+	addrs := strings.Join(args[1:], " ")
+	composer, _ := aerc.SelectedTab().(*widgets.Composer)
+
+	switch args[0] {
+	case "cc":
+		composer.AddEditor("Cc", addrs)
+	case "bcc":
+		composer.AddEditor("Bcc", addrs)
+	}
+
+	return nil
+}