-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
58 lines (51 loc) · 1.47 KB
/
main.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
package main
import (
"log"
"os"
cmd "github.com/duaraghav8/okta-admin/command"
"github.com/duaraghav8/okta-admin/version"
"github.com/mitchellh/cli"
)
func main() {
logger := log.New(os.Stdout, "", 0)
meta, err := createMeta()
if err != nil {
logger.Printf("Failed to create metadata for actions: %v\n", err)
os.Exit(1)
}
globalCommand := &cmd.Command{
Meta: meta,
Logger: logger,
}
c := cli.CLI{
Name: version.AppName,
Version: version.FormattedVersion(),
Commands: map[string]cli.CommandFactory{
"create-user": func() (command cli.Command, err error) {
return &cmd.CreateUserCommand{Command: globalCommand}, nil
},
"deactivate-user": func() (command cli.Command, err error) {
return &cmd.DeactivateUserCommand{Command: globalCommand}, nil
},
"reset-user-password": func() (command cli.Command, err error) {
return &cmd.ResetUserPasswordCommand{Command: globalCommand}, nil
},
"reset-user-mfa": func() (command cli.Command, err error) {
return &cmd.ResetUserMultifactorsCommand{Command: globalCommand}, nil
},
"list-groups": func() (command cli.Command, err error) {
return &cmd.ListGroupsCommand{Command: globalCommand}, nil
},
"assign-groups": func() (command cli.Command, err error) {
return &cmd.AssignUserGroupsCommand{Command: globalCommand}, nil
},
},
Args: os.Args[1:],
HelpWriter: os.Stdout,
}
exitStatus, err := c.Run()
if err != nil {
logger.Println(err)
}
os.Exit(exitStatus)
}