@@ -203,19 +203,22 @@ func toLogLevel(s string) (t logrus.Level, found bool) {
203203}
204204
205205func 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+ //
214209
215210 // Set default feedback output to colorable
211+ color .NoColor = noColor || os .Getenv ("NO_COLOR" ) != "" // https://no-color.org/
216212 feedback .SetOut (colorable .NewColorableStdout ())
217213 feedback .SetErr (colorable .NewColorableStderr ())
218214
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+
219222 //
220223 // Prepare logging
221224 //
@@ -260,20 +263,14 @@ func preRun(verbose bool, outputFormat string, logLevel, logFile, logFormat stri
260263 logrus .SetLevel (logrusLevel )
261264 }
262265
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 )
273268
274269 //
275- // Print some status info and check command is consistent
270+ // Initialize inventory
276271 //
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+ }
279276}
0 commit comments