@@ -203,19 +203,22 @@ func toLogLevel(s string) (t logrus.Level, found bool) {
203
203
}
204
204
205
205
func preRun (verbose bool , outputFormat string , logLevel , logFile , logFormat string , noColor bool , settings * rpc.Configuration ) {
206
- // initialize inventory
207
- err := inventory .Init (settings .GetDirectories ().GetData ())
208
- if err != nil {
209
- feedback .Fatal (fmt .Sprintf ("Error: %v" , err ), feedback .ErrInitializingInventory )
210
- }
211
-
212
- // https://no-color.org/
213
- color .NoColor = noColor || os .Getenv ("NO_COLOR" ) != ""
206
+ //
207
+ // Prepare the Feedback system
208
+ //
214
209
215
210
// Set default feedback output to colorable
211
+ color .NoColor = noColor || os .Getenv ("NO_COLOR" ) != "" // https://no-color.org/
216
212
feedback .SetOut (colorable .NewColorableStdout ())
217
213
feedback .SetErr (colorable .NewColorableStderr ())
218
214
215
+ // use the output format to configure the Feedback
216
+ format , ok := feedback .ParseOutputFormat (outputFormat )
217
+ if ! ok {
218
+ feedback .Fatal (tr ("Invalid output format: %s" , outputFormat ), feedback .ErrBadArgument )
219
+ }
220
+ feedback .SetFormat (format )
221
+
219
222
//
220
223
// Prepare logging
221
224
//
@@ -260,20 +263,14 @@ func preRun(verbose bool, outputFormat string, logLevel, logFile, logFormat stri
260
263
logrus .SetLevel (logrusLevel )
261
264
}
262
265
263
- //
264
- // Prepare the Feedback system
265
- //
266
-
267
- // use the output format to configure the Feedback
268
- format , ok := feedback .ParseOutputFormat (outputFormat )
269
- if ! ok {
270
- feedback .Fatal (tr ("Invalid output format: %s" , outputFormat ), feedback .ErrBadArgument )
271
- }
272
- feedback .SetFormat (format )
266
+ // Print some status info and check command is consistent
267
+ logrus .Info (versioninfo .VersionInfo .Application + " version " + versioninfo .VersionInfo .VersionString )
273
268
274
269
//
275
- // Print some status info and check command is consistent
270
+ // Initialize inventory
276
271
//
277
-
278
- logrus .Info (versioninfo .VersionInfo .Application + " version " + versioninfo .VersionInfo .VersionString )
272
+ err := inventory .Init (settings .GetDirectories ().GetData ())
273
+ if err != nil {
274
+ feedback .Fatal (fmt .Sprintf ("Error: %v" , err ), feedback .ErrInitializingInventory )
275
+ }
279
276
}
0 commit comments