-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
cmd_account_reset_cancel.go
59 lines (51 loc) · 1.34 KB
/
cmd_account_reset_cancel.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
53
54
55
56
57
58
59
package client
import (
"errors"
"github.com/keybase/cli"
"github.com/keybase/client/go/libcmdline"
"github.com/keybase/client/go/libkb"
"golang.org/x/net/context"
)
// Cancel the reset pipeline
type CmdAccountResetCancel struct {
libkb.Contextified
}
func NewCmdAccountResetCancel(cl *libcmdline.CommandLine, g *libkb.GlobalContext) cli.Command {
return cli.Command{
Name: "reset-cancel",
Usage: "Cancel the reset process for your account",
Unlisted: true,
Action: func(c *cli.Context) {
cmd := NewCmdAccountResetCancelRunner(g)
cl.ChooseCommand(cmd, "reset-cancel", c)
cl.SetSkipAccountResetCheck()
},
}
}
func NewCmdAccountResetCancelRunner(g *libkb.GlobalContext) *CmdAccountResetCancel {
return &CmdAccountResetCancel{Contextified: libkb.NewContextified(g)}
}
func (c *CmdAccountResetCancel) ParseArgv(ctx *cli.Context) error {
if len(ctx.Args()) != 0 {
return errors.New("cancel takes no arguments")
}
return nil
}
func (c *CmdAccountResetCancel) Run() error {
cli, err := GetAccountClient(c.G())
if err != nil {
return err
}
if err = cli.CancelReset(context.Background(), 0); err != nil {
return err
}
ui := c.G().UI.GetDumbOutputUI()
ui.Printf("Account reset cancelled.\n")
return nil
}
func (c *CmdAccountResetCancel) GetUsage() libkb.Usage {
return libkb.Usage{
API: true,
Config: true,
}
}