feat: notifications retry mechanism and improved error formatting

This commit is contained in:
yusing
2025-05-03 14:30:40 +08:00
parent 2fe4fef779
commit 82c829de18
9 changed files with 146 additions and 54 deletions

View File

@@ -20,6 +20,26 @@ const (
HighlightWhite = BrightWhite + Bold
)
func Error(s string) string {
return WithANSI(s, HighlightRed)
}
func Success(s string) string {
return WithANSI(s, HighlightGreen)
}
func Warning(s string) string {
return WithANSI(s, HighlightYellow)
}
func Info(s string) string {
return WithANSI(s, HighlightCyan)
}
func WithANSI(s string, ansi string) string {
return ansi + s + Reset
}
func StripANSI(s string) string {
return ansiRegexp.ReplaceAllString(s, "")
}

View File

@@ -219,7 +219,7 @@ func DoYouMean(s string) string {
if s == "" {
return ""
}
return "Did you mean " + ansi.HighlightGreen + s + ansi.Reset + "?"
return "Did you mean " + ansi.Info(s) + "?"
}
func Pluralize(n int64) string {