diff options
author | Jelle Besseling <jelle@pingiun.com> | 2019-08-18 11:33:14 +0200 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-08-20 10:04:29 +0900 |
commit | 36c6030e81b229414bb42bf7fc37d091c6497ddf (patch) | |
tree | c5de62c269ae514408281f8323e79a1b5920fa7a /commands/msg | |
parent | 217e8855f223258dc12a6adc836f6e1678ade03f (diff) | |
download | aerc-36c6030e81b229414bb42bf7fc37d091c6497ddf.zip |
Add addresses argument to forward command
Diffstat (limited to 'commands/msg')
-rw-r--r-- | commands/msg/forward.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/commands/msg/forward.go b/commands/msg/forward.go index d7ecf66..ca29096 100644 --- a/commands/msg/forward.go +++ b/commands/msg/forward.go @@ -8,6 +8,7 @@ import ( "github.com/emersion/go-message" "github.com/emersion/go-message/mail" "io" + "strings" ) type forward struct{} @@ -25,8 +26,9 @@ func (_ forward) Complete(aerc *widgets.Aerc, args []string) []string { } func (_ forward) Execute(aerc *widgets.Aerc, args []string) error { + to := "" if len(args) != 1 { - return errors.New("Usage: forward") + to = strings.Join(args[1:], ", ") } widget := aerc.SelectedTab().(widgets.ProvidesMessage) @@ -46,6 +48,7 @@ func (_ forward) Execute(aerc *widgets.Aerc, args []string) error { subject := "Fwd: " + msg.Envelope.Subject defaults := map[string]string{ + "To": to, "Subject": subject, } composer := widgets.NewComposer(aerc.Config(), acct.AccountConfig(), @@ -53,6 +56,11 @@ func (_ forward) Execute(aerc *widgets.Aerc, args []string) error { addTab := func() { tab := aerc.NewTab(composer, subject) + if len(args) == 1 { + composer.FocusRecipient() + } else { + composer.FocusTerminal() + } composer.OnHeaderChange("Subject", func(subject string) { if subject == "" { tab.Name = "New email" |