new hint ui function

This commit is contained in:
2025-12-31 12:16:51 -05:00
parent 1c229f1b3e
commit 4abf2969ca

View File

@@ -11,6 +11,10 @@ import (
"github.com/fatih/color" "github.com/fatih/color"
) )
const (
hint_color = 0xbda02a
)
/* print out the current path (route) and relevant error */ /* print out the current path (route) and relevant error */
func Path(path string, err error) { func Path(path string, err error) {
path = strings.TrimPrefix(path, "/") path = strings.TrimPrefix(path, "/")
@@ -48,6 +52,16 @@ func Fatal(msg string, err error) error {
panic(err) panic(err)
} }
/* print a useful hint to the user */
func Hint(format string, args ...any) {
color.RGB(func(hex int) (r, g, b int) {
r = (hex >> 16) & 0xFF
g = (hex >> 8) & 0xFF
b = hex & 0xFF
return
}(hint_color)).Printf("hint: %s\n", fmt.Sprintf(format, args...))
}
/* print message using the ok status color */ /* print message using the ok status color */
func OK(msg string) { func OK(msg string) {
color.Green(msg) color.Green(msg)