From 5b4b548aa0d61d3b2fe01ca3bf71d19401f69cb5 Mon Sep 17 00:00:00 2001 From: danbudris Date: Fri, 17 Sep 2021 11:20:39 -0400 Subject: [PATCH] if interactive, only return the print archivePath to stdout; if non-interactive, print whole analysis as json --- cmd/troubleshoot/cli/run.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cmd/troubleshoot/cli/run.go b/cmd/troubleshoot/cli/run.go index e1360714..81084212 100644 --- a/cmd/troubleshoot/cli/run.go +++ b/cmd/troubleshoot/cli/run.go @@ -195,12 +195,17 @@ the %s Admin Console to begin analysis.` return nil } - nonInteractiveOutput.ArchivePath = response.ArchivePath - output, err := nonInteractiveOutput.FormattedAnalysisOutput() - if err != nil { - return errors.Wrap(err, "failed to format non-interactive output") + if !interactive { + nonInteractiveOutput.ArchivePath = response.ArchivePath + output, err := nonInteractiveOutput.FormattedAnalysisOutput() + if err != nil { + return errors.Wrap(err, "failed to format non-interactive output") + } + fmt.Println(output) + return nil } - fmt.Println(output) + + fmt.Printf("%s\n", response.ArchivePath) return nil }