Skip to content

Commit

Permalink
Fix legend displaying wrong symbols (#226)
Browse files Browse the repository at this point in the history
This commit fixes a display error for "updated" and "deleted" items
which would always display a "+" symbol no matter what.
  • Loading branch information
moertel authored Dec 14, 2021
1 parent b411b04 commit 3048e55
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Order should be `CHANGE`, `FEATURE`, `ENHANCEMENT`, and `BUGFIX`

## unreleased/master

[FEATURE] Support Arm64 on Darwin for all binaries (benchtool etc). #215
* [FEATURE] Support Arm64 on Darwin for all binaries (benchtool etc). #215
* [BUGFIX] Fix `cortextool rules` legends displaying wrong symbols for updates and deletions. #226

## v0.10.7

Expand Down
4 changes: 2 additions & 2 deletions pkg/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ func (p *Printer) PrintComparisonResult(results []rules.NamespaceChange, verbose
p.Println("[green] +[reset] created")
}
if updated > 0 {
p.Println("[yellow] +[reset] updated")
p.Println("[yellow] ~[reset] updated")
}
if deleted > 0 {
p.Println("[red] +[reset] deleted")
p.Println("[red] -[reset] deleted")
}
fmt.Println()
fmt.Println("The following changes will be made if the provided rule set is synced:")
Expand Down
6 changes: 3 additions & 3 deletions pkg/rules/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ func PrintComparisonResult(results []NamespaceChange, verbose bool) error {
colorstring.Println("[green] +[reset] created") //nolint
}
if updated > 0 {
colorstring.Println("[yellow] +[reset] updated") //nolint
colorstring.Println("[yellow] ~[reset] updated") //nolint
}
if deleted > 0 {
colorstring.Println("[red] +[reset] deleted") //nolint
colorstring.Println("[red] -[reset] deleted") //nolint
}
fmt.Println()
fmt.Println("The following changes will be made if the provided rule set is synced:")
Expand Down Expand Up @@ -222,7 +222,7 @@ func PrintComparisonResult(results []NamespaceChange, verbose bool) error {
oldYaml, _ := yaml.Marshal(c.Original)
separated = strings.Split(string(oldYaml), "\n")
for _, l := range separated {
colorstring.Printf("[red]+ %v\n", l)
colorstring.Printf("[red]- %v\n", l)
}
}
}
Expand Down

0 comments on commit 3048e55

Please sign in to comment.