aboutsummaryrefslogtreecommitdiff
path: root/commands/account/compose.go
blob: c9be17a4554d75948a3f55ced9b1b2e7755e89f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package account

import (
	"errors"

	"github.com/mattn/go-runewidth"

	"git.sr.ht/~sircmpwn/aerc2/widgets"
)

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(acct.AccountConfig())
	// TODO: Change tab name when message subject changes
	aerc.NewTab(composer, runewidth.Truncate(
		"New email", 32, "…"))
	return nil
}