Skip to content

Commit

Permalink
Merge pull request #69 from asteris-llc/fix/color-printing
Browse files Browse the repository at this point in the history
add color printing again
  • Loading branch information
BrianHicks authored Jun 13, 2016
2 parents acefc3d + 47f6c2b commit 89019df
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 93 deletions.
13 changes: 6 additions & 7 deletions cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@ real happens.`,
logger.WithError(err).Fatal("applying failed")
}

// giving the results the type exec.Results allows us to pretty-print them
var typedResults exec.Results
for _, result := range results {
typedResults = append(typedResults, result)
}
fmt.Println(typedResults.Print(UseColor()))

// count successes and failures to print summary
var counts struct {
results, success, failures int
Expand All @@ -101,6 +94,12 @@ real happens.`,
} else {
counts.failures++
}

if UseColor() {
fmt.Println(result.Pretty())
} else {
fmt.Println(result)
}
}

// summarize the changes for the user
Expand Down
7 changes: 6 additions & 1 deletion cmd/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,16 @@ can be done separately to see what needs to be changed before execution.`,

fmt.Print("\n")
for _, result := range results {
fmt.Println(result)
counts.results++
if result.WillChange {
counts.changes++
}

if UseColor() {
fmt.Println(result.Pretty())
} else {
fmt.Println(result)
}
}

// summarize the potential changes for the user
Expand Down
49 changes: 0 additions & 49 deletions exec/print_results.go

This file was deleted.

36 changes: 0 additions & 36 deletions exec/print_results_test.go

This file was deleted.

0 comments on commit 89019df

Please sign in to comment.