Skip to content

Commit

Permalink
fix: Refactor human policy formatter (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
sagic-orca authored Jun 9, 2024
1 parent a2204c6 commit 86451d4
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions internal/outputer/formatter/formatter_human.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"fmt"
"strings"

"github.com/Legit-Labs/legitify/internal/common/severity"
"github.com/fatih/color"
tw "github.com/olekukonko/tablewriter"

"github.com/Legit-Labs/legitify/internal/common/severity"
"github.com/Legit-Labs/legitify/internal/outputer/scheme"
"github.com/fatih/color"
)

type HumanFormatter struct {
Expand Down Expand Up @@ -152,13 +152,9 @@ func (hp humanPolicyFormatter) FormatList(depth int, title string, list []string
}

var sb strings.Builder
bullet := "-"
sb.WriteString(hp.FormatText(depth, "%s\n", title))
for i, step := range list {
if ordered {
bullet = fmt.Sprintf("%d.", i+1)
}
sb.WriteString(hp.FormatText(depth, "%s %s\n", bullet, step))
for _, step := range list {
sb.WriteString(hp.FormatText(depth, "%s\n", step))
}

return sb.String()
Expand Down

0 comments on commit 86451d4

Please sign in to comment.