-
Notifications
You must be signed in to change notification settings - Fork 4
/
mmfa.go
54 lines (46 loc) · 947 Bytes
/
mmfa.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
package main
import (
"os"
"github.com/codegangsta/cli"
"github.com/thbishop/mmfa/commands"
)
func main() {
os.Exit(realMain())
}
func realMain() (exitCode int) {
exitCode = 0
app := cli.NewApp()
app.Name = "mmfa"
app.Usage = "osx keychain mfa manager"
app.Version = Version + VersionPrerelease
app.Commands = []cli.Command{
{
Name: "add",
Usage: "add a new keychain item",
Action: func(c *cli.Context) {
if !c.Args().Present() {
println("Name not provided\n")
cli.ShowCommandHelp(c, "add")
exitCode = 1
return
}
commands.AddKeychainItem(c.Args().First())
},
},
{
Name: "get",
Usage: "get the code for a keychain item",
Action: func(c *cli.Context) {
if !c.Args().Present() {
println("Name not provided\n")
cli.ShowCommandHelp(c, "get")
exitCode = 1
return
}
commands.GetCode(c.Args().First())
},
},
}
app.Run(os.Args)
return
}