aerc/commands/compose/cc-bcc.go

39 lines
615 B
Go
Raw Normal View History

2019-08-01 20:29:21 +02:00
package compose
import (
"strings"
"git.sr.ht/~rjarry/aerc/widgets"
2019-08-01 20:29:21 +02:00
)
type CC struct{}
func init() {
register(CC{})
}
func (CC) Aliases() []string {
2019-08-01 20:29:21 +02:00
return []string{"cc", "bcc"}
}
func (CC) Complete(aerc *widgets.Aerc, args []string) []string {
2019-08-01 20:29:21 +02:00
return nil
}
func (CC) Execute(aerc *widgets.Aerc, args []string) error {
var addrs string
if len(args) > 1 {
addrs = strings.Join(args[1:], " ")
2019-08-01 20:29:21 +02:00
}
composer, _ := aerc.SelectedTabContent().(*widgets.Composer)
2019-08-01 20:29:21 +02:00
switch args[0] {
case "cc":
composer.AddEditor("Cc", addrs, true)
2019-08-01 20:29:21 +02:00
case "bcc":
composer.AddEditor("Bcc", addrs, true)
2019-08-01 20:29:21 +02:00
}
return nil
}