aerc/commands/account/compose.go

32 lines
642 B
Go
Raw Normal View History

2019-05-12 06:06:09 +02:00
package account
import (
"errors"
2019-05-18 02:57:10 +02:00
"git.sr.ht/~sircmpwn/aerc/widgets"
2019-05-12 06:06:09 +02:00
)
func init() {
register("compose", Compose)
}
// TODO: Accept arguments for default headers, message body
func Compose(aerc *widgets.Aerc, args []string) error {
if len(args) != 1 {
return errors.New("Usage: compose")
}
acct := aerc.SelectedAccount()
composer := widgets.NewComposer(
aerc.Config(), acct.AccountConfig(), acct.Worker())
tab := aerc.NewTab(composer, "New email")
composer.OnSubjectChange(func(subject string) {
if subject == "" {
tab.Name = "New email"
} else {
tab.Name = subject
}
tab.Content.Invalidate()
})
2019-05-12 06:06:09 +02:00
return nil
}