diff options
author | JanUlrich <andi@michlaustderaffe.de> | 2019-06-05 00:05:46 +0200 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-06-05 09:32:43 -0400 |
commit | 0771eaf24c5a1f0e37e0a51fefe1cb5090fa7e2b (patch) | |
tree | 382c687f8a10f1c16a6cdc499edd104dc30aea34 /commands/new-account.go | |
parent | 7446a1783050c34eeefa5f5c030cd0cbbb8c70dd (diff) | |
download | aerc-0771eaf24c5a1f0e37e0a51fefe1cb5090fa7e2b.tar.gz |
Introduce :new-account -t
Adding the [-t] temporary flag to the new-account command - when using -t a newly created account will not be stored into the accounts.conf Issue #134
Diffstat (limited to 'commands/new-account.go')
-rw-r--r-- | commands/new-account.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/commands/new-account.go b/commands/new-account.go index 3d6551f..a98b597 100644 --- a/commands/new-account.go +++ b/commands/new-account.go @@ -4,6 +4,7 @@ import ( "errors" "git.sr.ht/~sircmpwn/aerc/widgets" + "git.sr.ht/~sircmpwn/getopt" ) func init() { @@ -11,10 +12,17 @@ func init() { } func CommandNewAccount(aerc *widgets.Aerc, args []string) error { - if len(args) != 1 { - return errors.New("Usage: new-account") + 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 } |