-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
169 lines (161 loc) · 3.17 KB
/
main.go
File metadata and controls
169 lines (161 loc) · 3.17 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
package main
import (
"os"
cli "github.com/urfave/cli"
"github.com/bugcrowd/secrets/commands"
"github.com/bugcrowd/secrets/libsecrets"
)
var (
Version string = "dev"
)
func main() {
libsecrets.G.Init()
scopeFlag := cli.StringFlag{
Name: "scope, s",
Value: "default",
Usage: "Scope to use",
}
app := cli.NewApp()
app.Name = "Secrets"
app.Usage = "Managing your application secrets"
app.Version = Version
app.Commands = []cli.Command{
{
Name: "init",
Usage: "Initialize a Secrets respository in the current directory",
Action: func(c *cli.Context) error {
commands.Init(c)
return nil
},
},
{
Name: "get",
Usage: "Get a value",
Action: func(c *cli.Context) error {
commands.Get(c)
return nil
},
Flags: []cli.Flag{scopeFlag},
},
{
Name: "set",
Usage: "Set a value",
Action: func(c *cli.Context) error {
commands.Set(c)
return nil
},
Flags: []cli.Flag{scopeFlag},
},
{
Name: "del",
Aliases: []string{"remove", "delete"},
Usage: "Delete a value",
Action: func(c *cli.Context) error {
commands.Del(c)
return nil
},
Flags: []cli.Flag{scopeFlag},
},
{
Name: "export",
Usage: "Export all data in a scope",
Flags: []cli.Flag{
scopeFlag,
cli.StringFlag{
Name: "format, f",
Value: "human",
Usage: "Valid formats are 'human', 'json', 'yaml' and 'env'.",
},
},
Action: func(c *cli.Context) error {
commands.Export(c)
return nil
},
},
{
Name: "import",
Usage: "Import data into a scope",
Flags: []cli.Flag{
scopeFlag,
cli.StringFlag{
Name: "format, f",
Value: "env",
Usage: "Valid formats are 'json' and 'yaml'.",
},
cli.StringFlag{
Name: "data, d",
Value: "",
Usage: "Data to import",
},
},
Action: func(c *cli.Context) error {
commands.Import(c)
return nil
},
},
{
Name: "members",
Usage: "Member management",
Subcommands: []cli.Command{
{
Name: "list",
Usage: "List members in a scope",
Action: func(c *cli.Context) error {
commands.MembersList(c)
return nil
},
Flags: []cli.Flag{scopeFlag},
},
{
Name: "add",
Usage: "Add members to a scope",
Action: func(c *cli.Context) error {
commands.MembersAdd(c)
return nil
},
Flags: []cli.Flag{scopeFlag},
},
{
Name: "remove",
Usage: "Remove members from a scope",
Action: func(c *cli.Context) error {
commands.MembersRemove(c)
return nil
},
Flags: []cli.Flag{scopeFlag},
},
},
},
{
Name: "scope",
Usage: "Scope management",
Subcommands: []cli.Command{
{
Name: "list",
Usage: "List existing scopes",
Action: func(c *cli.Context) error {
commands.ScopeList(c)
return nil
},
},
{
Name: "add",
Usage: "Add a new scope",
Action: func(c *cli.Context) error {
commands.ScopeAdd(c)
return nil
},
},
{
Name: "remove",
Usage: "Remove a scope",
Action: func(c *cli.Context) error {
commands.ScopeRemove(c)
return nil
},
},
},
},
}
app.Run(os.Args)
}