-
Notifications
You must be signed in to change notification settings - Fork 27
/
flags.go
138 lines (120 loc) · 3.17 KB
/
flags.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
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
package cli
import (
"fmt"
"github.com/urfave/cli"
)
const (
// PathEnvKey ...
PathEnvKey = "ENVMAN_ENVSTORE_PATH"
// PathKey ...
PathKey = "path"
pathKeyShort = "p"
// LogLevelEnvKey ...
LogLevelEnvKey = "LOGLEVEL"
// LogLevelKey ...
LogLevelKey = "loglevel"
logLevelKeyShort = "l"
// KeyKey ...
KeyKey = "key"
keyKeyShortT = "k"
// ValueKey ...
ValueKey = "value"
valueKeyShort = "v"
// ValueFileKey ...
ValueFileKey = "valuefile"
valueFileKeyShort = "f"
// NoExpandKey ...
NoExpandKey = "no-expand"
noExpandKeyShort = "n"
// AppendKey ...
AppendKey = "append"
appendKeyShort = "a"
// SkipIfEmptyKey ...
SkipIfEmptyKey = "skip-if-empty"
// SensitiveKey ...
SensitiveKey = "sensitive"
// ToolEnvKey ...
ToolEnvKey = "ENVMAN_TOOLMODE"
// ToolKey ...
ToolKey = "tool"
toolKeyShort = "t"
// ClearKey ....
ClearKey = "clear"
clearKeyShort = "c"
// HelpKey ...
HelpKey = "help"
helpKeyShort = "h"
// VersionKey ...
VersionKey = "version"
versionKeyShort = "v"
// ExpandKey ...
ExpandKey = "expand"
// SensitiveOnlyKey ...
SensitiveOnlyKey = "sensitive-only"
// FormatKey ...
FormatKey = "format"
// OutputFormatRaw ...
OutputFormatRaw = "raw"
// OutputFormatJSON ...
OutputFormatJSON = "json"
// OutputFormatExport
OutputFormatEnvList = "envlist"
)
var (
// App flags
flLogLevel = cli.StringFlag{
Name: LogLevelKey + ", " + logLevelKeyShort,
Value: "info",
Usage: "Log level (options: debug, info, warn, error, fatal, panic).",
EnvVar: LogLevelEnvKey,
}
flPath = cli.StringFlag{
Name: PathKey + ", " + pathKeyShort,
EnvVar: PathEnvKey,
Value: "",
Usage: "Path of the envstore.",
}
flTool = cli.BoolFlag{
Name: ToolKey + ", " + toolKeyShort,
EnvVar: ToolEnvKey,
Usage: "If enabled, envman will NOT ask for user inputs.",
}
flags = []cli.Flag{
flLogLevel,
flPath,
flTool,
}
// Command flags
flKey = cli.StringFlag{
Name: KeyKey + ", " + keyKeyShortT,
Usage: "Key of the environment variable. Empty string (\"\") is NOT accepted.",
}
flValue = cli.StringFlag{
Name: ValueKey + ", " + valueKeyShort,
Usage: "Value of the environment variable. Empty string is accepted.",
}
flValueFile = cli.StringFlag{
Name: ValueFileKey + ", " + valueFileKeyShort,
Usage: "Path of a file which contains the environment variable's value to be stored.",
}
flNoExpand = cli.BoolFlag{
Name: NoExpandKey + ", " + noExpandKeyShort,
Usage: "If enabled, envman will NOT replaces ${var} or $var in the string according to the values of the current environment variables.",
}
flAppend = cli.BoolFlag{
Name: AppendKey + ", " + appendKeyShort,
Usage: "If enabled, new env will append to envstore, otherwise if env exist with specified key, will replaced.",
}
flClear = cli.BoolFlag{
Name: ClearKey + ", " + clearKeyShort,
Usage: "If enabled, 'envman init' removes envstore if exist.",
}
flFormat = cli.StringFlag{
Name: FormatKey,
Usage: fmt.Sprintf("Output format (options: %s, %s, %s).", OutputFormatRaw, OutputFormatJSON, OutputFormatEnvList),
}
flExpand = cli.BoolFlag{
Name: ExpandKey,
Usage: "If enabled, expanded envs will use.",
}
)