allow the loading of existing headers

This commit is contained in:
Reto Brunner 2020-11-08 13:39:25 +01:00
parent 24f1c575ae
commit 256af6322b
1 changed files with 4 additions and 2 deletions

View File

@ -56,18 +56,20 @@ func (Header) Execute(aerc *widgets.Aerc, args []string) error {
composer, _ := aerc.SelectedTab().(*widgets.Composer)
value := strings.Join(args[optind+1:], " ")
if !force {
headers, err := composer.PrepareHeader()
if err != nil {
return err
}
if headers.Has(args[optind]) {
if headers.Has(args[optind]) && value != "" {
return fmt.Errorf("Header %s already exists", args[optind])
}
}
composer.AddEditor(args[optind], strings.Join(args[optind+1:], " "), false)
composer.AddEditor(args[optind], value, false)
return nil
}