Skip to content

Commit

Permalink
fix: details in json output
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Schuetz <thomas.schuetz@t-sc.eu>
  • Loading branch information
thschue committed Apr 5, 2023
1 parent 22e3166 commit 2f21002
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/analyze/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ var AnalyzeCmd = &cobra.Command{
os.Exit(1)
}

if explain && output != "json" {
err := config.GetAIResults(true)
if explain {
err := config.GetAIResults(output)
if err != nil {
color.Red("Error: %v", err)
os.Exit(1)
Expand Down
8 changes: 5 additions & 3 deletions pkg/analysis/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ func (a *Analysis) PrintOutput() {
}
}

func (a *Analysis) GetAIResults(progressBar bool) error {
func (a *Analysis) GetAIResults(output string) error {
if len(a.Results) == 0 {
return nil
}

var bar *progressbar.ProgressBar
if progressBar {
if output != "json" {
bar = progressbar.Default(int64(len(a.Results)))
}

Expand All @@ -151,7 +151,9 @@ func (a *Analysis) GetAIResults(progressBar bool) error {
continue
}
analysis.Details = parsedText
bar.Add(1)
if output != "json" {
bar.Add(1)
}
a.Results[index] = analysis
}
return nil
Expand Down

0 comments on commit 2f21002

Please sign in to comment.