forked from bitrise-io/bitrise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flags.go
200 lines (179 loc) · 4.39 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
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
package cli
import (
"github.com/bitrise-io/bitrise/configs"
"github.com/urfave/cli"
)
const (
// CollectionPathEnvKey ...
CollectionPathEnvKey = "STEPMAN_COLLECTION"
// CIKey ...
CIKey = "ci"
// PRKey ...
PRKey = "pr"
// DebugModeKey ...
DebugModeKey = "debug"
// LogLevelKey ...
LogLevelKey = "loglevel"
logLevelKeyShort = "l"
// VersionKey ...
VersionKey = "version"
versionKeyShort = "v"
// PathKey ...
PathKey = "path"
pathKeyShort = "p"
// CollectionKey ...
CollectionKey = "collection"
collectionKeyShort = "c"
inventoryShortKey = "i"
// InventoryBase64Key ...
InventoryBase64Key = "inventory-base64"
configShortKey = "c"
// ConfigBase64Key ...
ConfigBase64Key = "config-base64"
// HelpKey ...
HelpKey = "help"
helpKeyShort = "h"
// MinimalModeKey ...
MinimalModeKey = "minimal"
// FullModeKey ...
FullModeKey = "full"
ouputFormatKeyShort = "f"
// OuputPathKey ...
OuputPathKey = "outpath"
// PrettyFormatKey ...
PrettyFormatKey = "pretty"
// IDKey ...
IDKey = "id"
idKeyShort = "i"
// ShortKey ...
ShortKey = "short"
// StepYMLKey ...
StepYMLKey = "step-yml"
//
// Stepman share
// TagKey ...
TagKey = "tag"
// GitKey ...
GitKey = "git"
// StepIDKey ...
StepIDKey = "stepid"
)
var (
// App flags
flLogLevel = cli.StringFlag{
Name: LogLevelKey + ", " + logLevelKeyShort,
Usage: "Log level (options: debug, info, warn, error, fatal, panic).",
EnvVar: configs.LogLevelEnvKey,
}
flDebugMode = cli.BoolFlag{
Name: DebugModeKey,
Usage: "If true it enabled DEBUG mode. If no separate Log Level is specified this will also set the loglevel to debug.",
EnvVar: configs.DebugModeEnvKey,
}
flTool = cli.BoolFlag{
Name: CIKey,
Usage: "If true it indicates that we're used by another tool so don't require any user input!",
EnvVar: configs.CIModeEnvKey,
}
flPRMode = cli.BoolFlag{
Name: PRKey,
Usage: "If true bitrise runs in pull request mode.",
}
flags = []cli.Flag{
flLogLevel,
flDebugMode,
flTool,
flPRMode,
}
// Command flags
flOutputFormat = cli.StringFlag{
Name: OuputFormatKey + ", " + ouputFormatKeyShort,
Usage: "Output format. Accepted: raw (default), json, yml",
}
flPath = cli.StringFlag{
Name: PathKey + ", " + pathKeyShort,
Usage: "[Deprecated!!! Use 'config'] Path where the workflow config file is located.",
}
flCollection = cli.StringFlag{
Name: CollectionKey + ", " + collectionKeyShort,
Usage: "Collection of step.",
EnvVar: CollectionPathEnvKey,
}
flConfig = cli.StringFlag{
Name: ConfigKey + ", " + configShortKey,
Usage: "Path where the workflow config file is located.",
}
flConfigBase64 = cli.StringFlag{
Name: ConfigBase64Key,
Usage: "base64 decoded config data.",
}
flInventory = cli.StringFlag{
Name: InventoryKey + ", " + inventoryShortKey,
Usage: "Path of the inventory file.",
}
flInventoryBase64 = cli.StringFlag{
Name: InventoryBase64Key,
Usage: "base64 decoded inventory data.",
}
// Setup
flMinimalSetup = cli.BoolFlag{
Name: MinimalModeKey,
Usage: "[Deprecated!!!] Minimal setup mode: skips more thorough checking, like brew doctor.",
}
flFullModeSteup = cli.BoolFlag{
Name: FullModeKey,
Usage: "Full setup mode: also calls 'brew doctor'.",
}
// Export
flFormat = cli.StringFlag{
Name: OuputFormatKey,
Usage: "Output format. Accepted: json, yml.",
}
flOutputPath = cli.StringFlag{
Name: OuputPathKey,
Usage: "Output path, where the exported file will be saved.",
}
flPretty = cli.BoolFlag{
Name: PrettyFormatKey,
Usage: "Pretty printed export?",
}
flID = cli.StringFlag{
Name: IDKey + ", " + idKeyShort,
Usage: "Step id.",
}
flVersion = cli.StringFlag{
Name: VersionKey + ", " + versionKeyShort,
Usage: "Step version.",
}
flShort = cli.BoolFlag{
Name: ShortKey,
Usage: "Show short version of infos.",
}
flStepYML = cli.StringFlag{
Name: StepYMLKey,
Usage: "Path of step.yml",
}
// Stepman share
flTag = cli.StringFlag{
Name: TagKey,
Usage: "Git (version) tag.",
}
flGit = cli.StringFlag{
Name: GitKey,
Usage: "Git clone url of the step repository.",
}
flStepID = cli.StringFlag{
Name: StepIDKey,
Usage: "ID of the step.",
}
)
func initHelpAndVersionFlags() {
cli.HelpFlag = cli.BoolFlag{
Name: HelpKey + ", " + helpKeyShort,
Usage: "Show help.",
}
cli.VersionFlag = cli.BoolFlag{
Name: VersionKey + ", " + versionKeyShort,
Usage: "Print the version.",
}
}