forked from keybase/client
/
cmd_account_reset.go
52 lines (43 loc) · 1.09 KB
/
cmd_account_reset.go
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2017 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package client
import (
"errors"
"golang.org/x/net/context"
"github.com/keybase/cli"
"github.com/keybase/client/go/libcmdline"
"github.com/keybase/client/go/libkb"
)
type CmdAccountReset struct {
libkb.Contextified
}
func NewCmdAccountReset(cl *libcmdline.CommandLine, g *libkb.GlobalContext) cli.Command {
return cli.Command{
Name: "acctreset",
Usage: "Reset account",
Action: func(c *cli.Context) {
cmd := &CmdAccountReset{Contextified: libkb.NewContextified(g)}
cl.ChooseCommand(cmd, "acctreset", c)
},
}
}
func (c *CmdAccountReset) ParseArgv(ctx *cli.Context) error {
if len(ctx.Args()) != 0 {
return errors.New("acctdelete takes no arguments")
}
return nil
}
func (c *CmdAccountReset) Run() error {
cli, err := GetAccountClient(c.G())
if err != nil {
return err
}
return cli.ResetAccount(context.Background(), 0)
}
func (c *CmdAccountReset) GetUsage() libkb.Usage {
return libkb.Usage{
API: true,
KbKeyring: true,
Config: true,
}
}