aboutsummaryrefslogtreecommitdiffstats
path: root/commands/account/recover.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/account/recover.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/account/recover.go')
-rw-r--r--commands/account/recover.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/commands/account/recover.go b/commands/account/recover.go
index 3e4e9136..9fdaa3e9 100644
--- a/commands/account/recover.go
+++ b/commands/account/recover.go
@@ -8,6 +8,7 @@ import (
"path/filepath"
"git.sr.ht/~rjarry/aerc/commands"
+ "git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/widgets"
"git.sr.ht/~sircmpwn/getopt"
)
@@ -23,7 +24,7 @@ func (Recover) Aliases() []string {
}
func (Recover) Options() string {
- return "f"
+ return "feE"
}
func (r Recover) Complete(aerc *widgets.Aerc, args []string) []string {
@@ -45,19 +46,25 @@ func (r Recover) Execute(aerc *widgets.Aerc, args []string) error {
}
force := false
+ editHeaders := config.Compose.EditHeaders
opts, optind, err := getopt.Getopts(args, r.Options())
if err != nil {
return err
}
for _, opt := range opts {
- if opt.Option == 'f' {
+ switch opt.Option {
+ case 'f':
force = true
+ case 'e':
+ editHeaders = true
+ case 'E':
+ editHeaders = false
}
}
if len(args) <= optind {
- return errors.New("Usage: recover [-f] <file>")
+ return errors.New("Usage: recover [-f] [-E|-e] <file>")
}
acct := aerc.SelectedAccount()
@@ -83,7 +90,7 @@ func (r Recover) Execute(aerc *widgets.Aerc, args []string) error {
}
composer, err := widgets.NewComposer(aerc, acct,
- acct.AccountConfig(), acct.Worker(),
+ acct.AccountConfig(), acct.Worker(), editHeaders,
"", nil, nil, bytes.NewReader(data))
if err != nil {
return err