mirror of
https://git.sr.ht/~rjarry/aerc
synced 2025-02-23 07:53:59 +01:00

Split the compose commands into two categories: edit and review. Some commands can belong to both categories and be available whether the text editor or the review screen is visible. Update man page to reflect that. Remove duplicate (and misplaced) :save command from the COMPOSE section. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Bence Ferdinandy <bence@ferdinandy.com>
43 lines
880 B
Go
43 lines
880 B
Go
package compose
|
|
|
|
import (
|
|
"git.sr.ht/~rjarry/aerc/app"
|
|
"git.sr.ht/~rjarry/aerc/commands"
|
|
)
|
|
|
|
type CC struct {
|
|
Recipients string `opt:"recipients" complete:"CompleteAddress" desc:"Recipient from address book."`
|
|
}
|
|
|
|
func init() {
|
|
commands.Register(CC{})
|
|
}
|
|
|
|
func (CC) Description() string {
|
|
return "Add the given address(es) to the Cc or Bcc header."
|
|
}
|
|
|
|
func (CC) Context() commands.CommandContext {
|
|
return commands.COMPOSE_EDIT | commands.COMPOSE_REVIEW
|
|
}
|
|
|
|
func (CC) Aliases() []string {
|
|
return []string{"cc", "bcc"}
|
|
}
|
|
|
|
func (*CC) CompleteAddress(arg string) []string {
|
|
return commands.GetAddress(arg)
|
|
}
|
|
|
|
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
|
|
}
|