aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msg/forward.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-07-05 23:10:39 +0200
committerRobin Jarry <robin@jarry.cc>2023-07-17 10:24:17 +0200
commit4c514ce4d15fd14cad528cf426bc3f853efe7f64 (patch)
treefa52247b470a6af233a6e242962ed20e4831a555 /commands/msg/forward.go
parent11e5390fa0acbcc609ca177777548dd2d725afbc (diff)
downloadaerc-4c514ce4d15fd14cad528cf426bc3f853efe7f64.tar.gz
compose: allow changing edit-headers on the fly
Add -e|-E flags to all compose commands to allow switching between edit-headers = true/false without restarting aerc. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Bence Ferdinandy <bence@ferdinandy.com> Tested-by: Koni Marti <koni.marti@gmail.com>
Diffstat (limited to 'commands/msg/forward.go')
-rw-r--r--commands/msg/forward.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/commands/msg/forward.go b/commands/msg/forward.go
index ed0043fe..86c52059 100644
--- a/commands/msg/forward.go
+++ b/commands/msg/forward.go
@@ -39,13 +39,17 @@ func (forward) Complete(aerc *widgets.Aerc, args []string) []string {
}
func (forward) Execute(aerc *widgets.Aerc, args []string) error {
- opts, optind, err := getopt.Getopts(args, "AFT:")
+ opts, optind, err := getopt.Getopts(args, "AFT:eE")
if err != nil {
return err
}
+ if len(args) != optind {
+ return errors.New("Usage: forward [-A|-F] [-T <template>] [-e|-E]")
+ }
attachAll := false
attachFull := false
template := ""
+ editHeaders := config.Compose.EditHeaders
for _, opt := range opts {
switch opt.Option {
case 'A':
@@ -54,6 +58,10 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error {
attachFull = true
case 'T':
template = opt.Value
+ case 'e':
+ editHeaders = true
+ case 'E':
+ editHeaders = false
}
}
@@ -100,7 +108,8 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error {
addTab := func() (*widgets.Composer, error) {
composer, err := widgets.NewComposer(aerc, acct,
- acct.AccountConfig(), acct.Worker(), template, h, &original, nil)
+ acct.AccountConfig(), acct.Worker(), editHeaders,
+ template, h, &original, nil)
if err != nil {
aerc.PushError("Error: " + err.Error())
return nil, err