Open Praveen005 opened 2 weeks ago
@Praveen005 can you provide an example (possibly a screenshot) of the preview of any existing command by using the color_util.go
you provided above
This is the output with ANSI Codes:
This is with the present code:
You would have also noticed that, the first Error
is not colored, and the reason is because, It is being directly printed using fmt.Printf()
Likely reason for doing this might be because when we import utility
package in config
, it leads to circular import.
But there is a workaround for isolated cases, we can directly use the ANSI code for Red in the string itself, like:
Result:
Background:
Currently, the CLI uses the
github.com/gookit/color
library to handle colored output in the console. While this library does its job well, it introduces an additional dependency that might not be necessary.Suggestion:
I propose replacing the github.com/gookit/color library with ANSI escape codes for coloring text in
utility/color_util.go
Here is how the current functions could be rewritten using ANSI escape codes:
color_util.go