From f4b774146387f147d6e693d789889bfdd817a290 Mon Sep 17 00:00:00 2001 From: Daniel Bridges Date: Thu, 1 Aug 2019 11:29:21 -0700 Subject: Add cc and bcc commands --- commands/compose/cc-bcc.go | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 commands/compose/cc-bcc.go (limited to 'commands') 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 ", 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 +} -- cgit v1.2.3