Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Refactor human policy formatter #313

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading