aboutsummaryrefslogtreecommitdiffstats
path: root/commands/compose/cc-bcc.go
blob: d54a9895fe23148d19d21e3cedba22fa03b217f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package compose

import (
	"git.sr.ht/~rjarry/aerc/app"
	"git.sr.ht/~rjarry/aerc/commands"
)

type CC struct {
	Recipients string `opt:"recipients"`
}

func init() {
	commands.Register(CC{})
}

func (CC) Context() commands.CommandContext {
	return commands.COMPOSE
}

func (CC) Aliases() []string {
	return []string{"cc", "bcc"}
}

func (c CC) Execute(args []string) error {
	composer, _ := app.SelectedTabContent().(*app.Composer)

	switch args[0] {
	case "cc":
		return composer.AddEditor("Cc", c.Recipients, true)
	case "bcc":
		return composer.AddEditor("Bcc", c.Recipients, true)
	}

	return nil
}