aboutsummaryrefslogtreecommitdiffstats
path: root/commands/new-account.go
blob: 9e70dec2267e8df5b7695665a9b6850153edfd9b (plain) (blame)
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 commands

import (
	"errors"

	"git.sr.ht/~sircmpwn/aerc/widgets"
	"git.sr.ht/~sircmpwn/getopt"
)

func init() {
	register("new-account", CommandNewAccount)
}

func CommandNewAccount(aerc *widgets.Aerc, args []string) error {
	opts, _, err := getopt.Getopts(args, "t")
	if err != nil {
		return errors.New("Usage: new-account [-t]")
	}
	wizard := widgets.NewAccountWizard(aerc.Config(), aerc)
	for _, opt := range opts {
		switch opt.Option {
		case 't':
			wizard.ConfigureTemporaryAccount(true)
		}
	}
	aerc.NewTab(wizard, "New account")
	return nil
}