summary refs log blame commit diff stats
path: root/commands/new-account.go
blob: a98b597cc251c1c5e7dc5719b773842eeb4853b6 (plain) (tree)
1
2
3
4
5
6
7





                                          
                                    






                                                                 


                                                            
         
                                                               





                                                              


                                          
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[1:], "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
}