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: properly remove emojis in pretty format with no color #765

Merged
merged 2 commits into from
Jul 28, 2022
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
3 changes: 2 additions & 1 deletion pkg/validator/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package validator

import (
"fmt"
"strings"
"time"

"github.com/fatih/color"
Expand Down Expand Up @@ -244,7 +245,7 @@ func (res ResultSet) GetPrettyOutput() string {
}
}
if color.NoColor {
status = status[2:] // remove emoji
status = strings.Fields(status)[1] // remove emoji
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this would be safer as

strings.Join(strings.Fields(status)[1:], " ")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not a big deal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rbren Please, feel free to adjust it to whatever serves the project best :)

}
str += fmt.Sprintf("%s%s %s\n", indent, checkColor.Sprint(fillString(msg.ID, minIDLength-len(indent))), status)
str += fmt.Sprintf("%s %s - %s\n", indent, msg.Category, msg.Message)
Expand Down