diff options
author | Daniel Bridges <bridges2@gmail.com> | 2019-08-01 11:29:21 -0700 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-08-03 10:43:55 -0400 |
commit | f4b774146387f147d6e693d789889bfdd817a290 (patch) | |
tree | 9698171277749cc9885a161de45895c57649d130 /commands/compose/cc-bcc.go | |
parent | b72bb27cb45f25d1df0d93be17474d8a08715411 (diff) | |
download | aerc-f4b774146387f147d6e693d789889bfdd817a290.tar.gz |
Add cc and bcc commands
Diffstat (limited to 'commands/compose/cc-bcc.go')
-rw-r--r-- | commands/compose/cc-bcc.go | 39 |
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 +} |