mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
chore: Improve console error experience (#124)
* chore: Improve console error experience * fix: Use standard error code and handle verbosity
This commit is contained in:
+16
-12
@@ -5,19 +5,23 @@ import "github.com/fatih/color"
|
||||
type ColorFn func(format string, a ...interface{}) string
|
||||
|
||||
type TerminalColors struct {
|
||||
Normal ColorFn
|
||||
Red ColorFn
|
||||
Yellow ColorFn
|
||||
Cyan ColorFn
|
||||
Green ColorFn
|
||||
Bold ColorFn
|
||||
Normal ColorFn
|
||||
Red ColorFn
|
||||
Yellow ColorFn
|
||||
Cyan ColorFn
|
||||
Green ColorFn
|
||||
Bold ColorFn
|
||||
Dim ColorFn
|
||||
ErrorCode ColorFn
|
||||
}
|
||||
|
||||
var Colors = TerminalColors{
|
||||
Normal: color.New().SprintfFunc(),
|
||||
Red: color.New(color.FgRed, color.Bold).SprintfFunc(),
|
||||
Yellow: color.New(color.FgYellow).SprintfFunc(),
|
||||
Cyan: color.New(color.FgCyan).SprintfFunc(),
|
||||
Green: color.New(color.FgGreen).SprintfFunc(),
|
||||
Bold: color.New(color.Bold).SprintfFunc(),
|
||||
Normal: color.New().SprintfFunc(),
|
||||
Red: color.New(color.FgRed, color.Bold).SprintfFunc(),
|
||||
Yellow: color.New(color.FgYellow).SprintfFunc(),
|
||||
Cyan: color.New(color.FgCyan).SprintfFunc(),
|
||||
Green: color.New(color.FgGreen).SprintfFunc(),
|
||||
Bold: color.New(color.Bold).SprintfFunc(),
|
||||
Dim: color.New(color.Faint).SprintfFunc(),
|
||||
ErrorCode: color.New(color.BgRed, color.FgBlack, color.Bold).SprintfFunc(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user