/
users.go
72 lines (58 loc) · 1.41 KB
/
users.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
60
61
62
63
64
65
66
67
68
69
70
71
72
package cmd
import (
"fmt"
"os"
"github.com/astronomerio/astro-cli/users"
"github.com/spf13/cobra"
)
var (
skipVerify bool
userEmail string
usersRootCmd = &cobra.Command{
Use: "users",
Short: "Manage astronomer users",
Long: "Manage astronomer users",
}
usersListCmd = &cobra.Command{
Use: "list",
Short: "List astronomer users",
Long: "List astronomer users",
Run: usersList,
}
usersCreateCmd = &cobra.Command{
Use: "create",
Short: "Add an astronomer user",
Long: "Add an astronomer user",
RunE: usersCreate,
}
usersDeleteCmd = &cobra.Command{
Use: "delete",
Short: "Delete an astronomer user",
Long: "Delete an astronomer user",
Run: usersDelete,
}
)
func init() {
// Users root
RootCmd.AddCommand(usersRootCmd)
// Users list
usersRootCmd.AddCommand(usersListCmd)
// Users create
usersRootCmd.AddCommand(usersCreateCmd)
usersCreateCmd.Flags().BoolVar(&skipVerify, "skip-verify", false, "Skips password verification on create")
usersCreateCmd.Flags().StringVar(&userEmail, "email", "", "Supply user email at runtime")
// Users delete
usersRootCmd.AddCommand(usersDeleteCmd)
}
func usersList(cmd *cobra.Command, args []string) {
}
func usersCreate(cmd *cobra.Command, args []string) error {
err := users.CreateUser(skipVerify, userEmail)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
return nil
}
func usersDelete(cmd *cobra.Command, args []string) {
}