refactor: remove error_icon property

This commit is contained in:
Jan De Dobbeleer 2020-09-30 11:25:54 +02:00 committed by Jan De Dobbeleer
parent 71c610aaa8
commit 592f4147a2
17 changed files with 17 additions and 24 deletions

View file

@ -71,7 +71,7 @@
"foreground": "#ffffff", "foreground": "#ffffff",
"background": "#ff8080", "background": "#ff8080",
"properties": { "properties": {
"error_icon": "" "prefix": ""
} }
} }
] ]

View file

@ -41,7 +41,7 @@
"style": "plain", "style": "plain",
"foreground": "#C94A16", "foreground": "#C94A16",
"properties": { "properties": {
"error_icon": "x" "prefix": "x"
} }
} }
] ]

View file

@ -46,8 +46,7 @@
"style": "plain", "style": "plain",
"foreground": "#ffffff", "foreground": "#ffffff",
"properties": { "properties": {
"error_icon": "x", "prefix": "<#CB4B16>[x</>",
"prefix": "<#CB4B16>[</>",
"postfix": "<#CB4B16>]</>" "postfix": "<#CB4B16>]</>"
} }
} }

View file

@ -52,7 +52,7 @@
"style": "plain", "style": "plain",
"foreground": "#C94A16", "foreground": "#C94A16",
"properties": { "properties": {
"error_icon": "x" "prefix": "x"
} }
}, },
{ {

View file

@ -9,7 +9,7 @@
"style": "plain", "style": "plain",
"foreground": "#ffffff", "foreground": "#ffffff",
"properties": { "properties": {
"error_icon": " ", "prefix": " ",
"postfix": "" "postfix": ""
} }
}, },

View file

@ -89,8 +89,7 @@
"style": "plain", "style": "plain",
"foreground": "#CB4B16", "foreground": "#CB4B16",
"properties": { "properties": {
"prefix": "", "prefix": ""
"error_icon": ""
} }
}, },
{ {

View file

@ -91,12 +91,11 @@
"leading_diamond": "", "leading_diamond": "",
"trailing_diamond": "", "trailing_diamond": "",
"properties": { "properties": {
"error_icon": "",
"display_exit_code": false, "display_exit_code": false,
"always_enabled": true, "always_enabled": true,
"error_color": "#e91e63", "error_color": "#e91e63",
"color_background": true, "color_background": true,
"prefix": "<#193549> </>" "prefix": "<#193549></>"
} }
} }
] ]

View file

@ -36,7 +36,7 @@
"style": "plain", "style": "plain",
"foreground": "#DCB977", "foreground": "#DCB977",
"properties": { "properties": {
"error_icon": "✗", "prefix": "✗",
"display_exit_code": false "display_exit_code": false
} }
}, },

View file

@ -71,7 +71,7 @@
"foreground": "#ffffff", "foreground": "#ffffff",
"background": "#ff8080", "background": "#ff8080",
"properties": { "properties": {
"error_icon": "" "prefix": ""
} }
} }
] ]

View file

@ -37,7 +37,7 @@
"style": "plain", "style": "plain",
"foreground": "#DCB977", "foreground": "#DCB977",
"properties": { "properties": {
"error_icon": "✗", "prefix": "✗",
"display_exit_code": false "display_exit_code": false
} }
} }

View file

@ -92,8 +92,7 @@
"style": "plain", "style": "plain",
"foreground": "#D4E157", "foreground": "#D4E157",
"properties": { "properties": {
"prefix": "", "prefix": "",
"error_icon": "",
"always_enabled": true, "always_enabled": true,
"error_color": "#FF5252", "error_color": "#FF5252",
"display_exit_code": false "display_exit_code": false

View file

@ -64,7 +64,7 @@
"foreground": "#ffffff", "foreground": "#ffffff",
"background": "#ff8080", "background": "#ff8080",
"properties": { "properties": {
"error_icon": "" "prefix": ""
} }
} }
] ]

View file

@ -37,7 +37,7 @@
"style": "plain", "style": "plain",
"foreground": "#DCB977", "foreground": "#DCB977",
"properties": { "properties": {
"error_icon": "✗", "prefix": "✗",
"display_exit_code": false "display_exit_code": false
} }
} }

View file

@ -9,7 +9,7 @@
"style": "plain", "style": "plain",
"foreground": "#CB4B16", "foreground": "#CB4B16",
"properties": { "properties": {
"error_icon": "" "prefix": ""
} }
}, },
{ {

View file

@ -47,7 +47,7 @@
"style": "plain", "style": "plain",
"foreground": "#C94A16", "foreground": "#C94A16",
"properties": { "properties": {
"error_icon": "x" "prefix": "x"
} }
} }
] ]

View file

@ -49,7 +49,7 @@
"style": "plain", "style": "plain",
"foreground": "#DCB977", "foreground": "#DCB977",
"properties": { "properties": {
"error_icon": "✗", "prefix": "✗",
"display_exit_code": false, "display_exit_code": false,
"postfix": "" "postfix": ""
} }

View file

@ -8,8 +8,6 @@ type exit struct {
} }
const ( const (
//ErrorIcon represents icon to display in case of error
ErrorIcon Property = "error_icon"
//DisplayExitCode shows or hides the error code //DisplayExitCode shows or hides the error code
DisplayExitCode Property = "display_exit_code" DisplayExitCode Property = "display_exit_code"
//AlwaysEnabled decides whether or not to always display the exitcode info //AlwaysEnabled decides whether or not to always display the exitcode info
@ -35,7 +33,6 @@ func (e *exit) init(props *properties, env environmentInfo) {
} }
func (e *exit) getFormattedText() string { func (e *exit) getFormattedText() string {
errorIcon := e.props.getString(ErrorIcon, "X")
exitCode := e.getMeaningFromExitCode() exitCode := e.getMeaningFromExitCode()
colorBackground := e.props.getBool(ColorBackground, false) colorBackground := e.props.getBool(ColorBackground, false)
if e.env.lastErrorCode() != 0 && !colorBackground { if e.env.lastErrorCode() != 0 && !colorBackground {
@ -44,7 +41,7 @@ func (e *exit) getFormattedText() string {
if e.env.lastErrorCode() != 0 && colorBackground { if e.env.lastErrorCode() != 0 && colorBackground {
e.props.background = e.props.getColor(ErrorColor, e.props.background) e.props.background = e.props.getColor(ErrorColor, e.props.background)
} }
return fmt.Sprintf("%s%s", errorIcon, exitCode) return exitCode
} }
func (e *exit) getMeaningFromExitCode() string { func (e *exit) getMeaningFromExitCode() string {