Debian Codegraph @

commands/compose/cc-bcc.go

raw
1 package compose
2
3 import (
4 "git.sr.ht/~rjarry/aerc/app"
5 "git.sr.ht/~rjarry/aerc/commands"
6 )
7
8 type CC struct {
9 Recipients string `opt:"recipients" complete:"CompleteAddress" desc:"Recipient from address book."`
10 }
11
12 func init() {
13 commands.Register(CC{})
14 }
15
16 func (CC) Description() string {
17 return "Add the given address(es) to the Cc or Bcc header."
18 }
19
20 func (CC) Context() commands.CommandContext {
21 return commands.COMPOSE_EDIT | commands.COMPOSE_REVIEW
22 }
23
24 func (CC) Aliases() []string {
25 return []string{"cc", "bcc"}
26 }
27
28 func (*CC) CompleteAddress(arg string) []string {
29 return commands.GetAddress(arg)
30 }
31
32 func (c CC) Execute(args []string) error {
33 composer, _ := app.SelectedTabContent().(*app.Composer)
34
35 switch args[0] {
36 case "cc":
37 return composer.AddEditor("Cc", c.Recipients, true)
38 case "bcc":
39 return composer.AddEditor("Bcc", c.Recipients, true)
40 }
41
42 return nil
43 }