-
Notifications
You must be signed in to change notification settings - Fork 27
/
commands.go
89 lines (87 loc) · 2.08 KB
/
commands.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package cli
import "github.com/urfave/cli"
var (
commands = []cli.Command{
{
Name: "version",
Usage: "Prints the version",
Action: printVersionCmd,
Flags: []cli.Flag{
cli.StringFlag{
Name: "format",
Usage: "Output format. Accepted: json, yml",
},
cli.BoolFlag{
Name: "full",
Usage: "Prints the build number and commit as well.",
},
},
},
{
Name: "init",
Aliases: []string{"i"},
Usage: "Create an empty .envstore.yml into the current working directory, or to the path specified by the --path flag.",
Action: initEnvStore,
Flags: []cli.Flag{
flClear,
},
},
{
Name: "add",
Aliases: []string{"a"},
Usage: "Add new, or update an exist environment variable.",
Action: add,
Flags: []cli.Flag{
flKey,
flValue,
flValueFile,
flNoExpand,
flAppend,
cli.BoolFlag{
Name: SkipIfEmptyKey,
Usage: "If enabled the added environment variable will be skipped during envman run, if the value is empty. If not set then the empty value will be used.",
},
cli.BoolFlag{
Name: SensitiveKey,
Usage: "The environment variable will be marked as sensitive.",
},
},
},
{
Name: "clear",
Aliases: []string{"c"},
Usage: "Clear the envstore.",
Action: clear,
},
{
Name: "print",
Aliases: []string{"p"},
Usage: "Print out the environment variables in envstore.",
Action: printCmd,
Flags: []cli.Flag{
flFormat,
flExpand,
cli.BoolFlag{
Name: SensitiveOnlyKey,
Usage: "Print the only environment variables that are marked as sensitive.",
},
},
},
{
Name: "run",
Aliases: []string{"r"},
Usage: "Run the specified command with the environment variables stored in the envstore.",
SkipFlagParsing: true,
Action: run,
},
{
Name: "unset",
Aliases: []string{"rm"},
Usage: "Enlist an environment variable to be unset (for example to clear OS inherited vars for the process).",
Action: unset,
Flags: []cli.Flag{
flKey,
},
},
}
)