aerc/commands/new-account.go

29 lines
566 B
Go
Raw Normal View History

2019-05-21 22:31:04 +02:00
package commands
import (
"errors"
"git.sr.ht/~sircmpwn/aerc/widgets"
"git.sr.ht/~sircmpwn/getopt"
2019-05-21 22:31:04 +02:00
)
func init() {
register("new-account", CommandNewAccount)
}
func CommandNewAccount(aerc *widgets.Aerc, args []string) error {
opts, _, err := getopt.Getopts(args[1:], "t")
if err != nil {
return errors.New("Usage: new-account [-t]")
2019-05-21 22:31:04 +02:00
}
wizard := widgets.NewAccountWizard(aerc.Config(), aerc)
for _, opt := range opts {
switch opt.Option {
case 't':
wizard.ConfigureTemporaryAccount(true)
}
}
2019-05-21 22:31:04 +02:00
aerc.NewTab(wizard, "New account")
return nil
}