aboutsummaryrefslogtreecommitdiffstats
path: root/commands/new-account.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/new-account.go')
-rw-r--r--commands/new-account.go19
1 files changed, 5 insertions, 14 deletions
diff --git a/commands/new-account.go b/commands/new-account.go
index 0f84141f..b30e0e34 100644
--- a/commands/new-account.go
+++ b/commands/new-account.go
@@ -1,13 +1,12 @@
package commands
import (
- "errors"
-
"git.sr.ht/~rjarry/aerc/app"
- "git.sr.ht/~sircmpwn/getopt"
)
-type NewAccount struct{}
+type NewAccount struct {
+ Temp bool `opt:"-t"`
+}
func init() {
register(NewAccount{})
@@ -21,17 +20,9 @@ func (NewAccount) Complete(args []string) []string {
return nil
}
-func (NewAccount) Execute(args []string) error {
- opts, _, err := getopt.Getopts(args, "t")
- if err != nil {
- return errors.New("Usage: new-account [-t]")
- }
+func (n NewAccount) Execute(args []string) error {
wizard := app.NewAccountWizard()
- for _, opt := range opts {
- if opt.Option == 't' {
- wizard.ConfigureTemporaryAccount(true)
- }
- }
+ wizard.ConfigureTemporaryAccount(n.Temp)
wizard.Focus(true)
app.NewTab(wizard, "New account")
return nil