allow the loading of existing headers
This commit is contained in:
parent
24f1c575ae
commit
256af6322b
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue