aboutsummaryrefslogtreecommitdiffstats
path: root/commands/compose/edit.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/compose/edit.go')
-rw-r--r--commands/compose/edit.go25
1 files changed, 21 insertions, 4 deletions
diff --git a/commands/compose/edit.go b/commands/compose/edit.go
index 6f877346..1e8e0672 100644
--- a/commands/compose/edit.go
+++ b/commands/compose/edit.go
@@ -3,7 +3,9 @@ package compose
import (
"errors"
+ "git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/widgets"
+ "git.sr.ht/~sircmpwn/getopt"
)
type Edit struct{}
@@ -21,14 +23,29 @@ func (Edit) Complete(aerc *widgets.Aerc, args []string) []string {
}
func (Edit) Execute(aerc *widgets.Aerc, args []string) error {
- if len(args) != 1 {
- return errors.New("Usage: edit")
- }
composer, ok := aerc.SelectedTabContent().(*widgets.Composer)
if !ok {
return errors.New("only valid while composing")
}
- err := composer.ShowTerminal()
+
+ editHeaders := config.Compose.EditHeaders
+ opts, optind, err := getopt.Getopts(args, "eE")
+ if err != nil {
+ return err
+ }
+ if len(args) != optind {
+ return errors.New("Usage: edit [-e|-E]")
+ }
+ for _, opt := range opts {
+ switch opt.Option {
+ case 'e':
+ editHeaders = true
+ case 'E':
+ editHeaders = false
+ }
+ }
+
+ err = composer.ShowTerminal(editHeaders)
if err != nil {
return err
}