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

Added support for printing red & green colored text #1331

Merged
merged 1 commit into from
Jan 15, 2025
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: 11 additions & 1 deletion utils/coreutils/cmdutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func extractBoolOptionFromArgs(args []string, optionName string) (cleanArgs []st

// Add green color style to the string if possible.
func PrintTitle(str string) string {
return colorStr(str, color.Green)
return PrintGreen(str)
}

// Add cyan color style to the string if possible.
Expand All @@ -253,11 +253,21 @@ func PrintComment(str string) string {
return colorStr(str, color.Gray)
}

// Add red color style to the string if possible.
func PrintRed(str string) string {
return colorStr(str, color.Red)
}

// Add yellow color style to the string if possible.
func PrintYellow(str string) string {
return colorStr(str, color.Yellow)
}

// Add green color style to the string if possible.
func PrintGreen(str string) string {
return colorStr(str, color.Green)
}

// Add the requested style to the string if possible.
func colorStr(str string, c color.Color) string {
// Add styles only on supported terminals
Expand Down
Loading