Skip to content

Commit

Permalink
refactor: remove error_icon property
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Oct 5, 2020
1 parent 71c610a commit 592f414
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Themes/agnoster.json
Expand Up @@ -71,7 +71,7 @@
"foreground": "#ffffff",
"background": "#ff8080",
"properties": {
"error_icon": ""
"prefix": ""
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion Themes/avit.json
Expand Up @@ -41,7 +41,7 @@
"style": "plain",
"foreground": "#C94A16",
"properties": {
"error_icon": "x"
"prefix": "x"
}
}
]
Expand Down
3 changes: 1 addition & 2 deletions Themes/darkblood.json
Expand Up @@ -46,8 +46,7 @@
"style": "plain",
"foreground": "#ffffff",
"properties": {
"error_icon": "x",
"prefix": "<#CB4B16>[</>",
"prefix": "<#CB4B16>[x</>",
"postfix": "<#CB4B16>]</>"
}
}
Expand Down
2 changes: 1 addition & 1 deletion Themes/emodipt.json
Expand Up @@ -52,7 +52,7 @@
"style": "plain",
"foreground": "#C94A16",
"properties": {
"error_icon": "x"
"prefix": "x"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Themes/fish.json
Expand Up @@ -9,7 +9,7 @@
"style": "plain",
"foreground": "#ffffff",
"properties": {
"error_icon": "",
"prefix": "",
"postfix": ""
}
},
Expand Down
3 changes: 1 addition & 2 deletions Themes/honukai.json
Expand Up @@ -89,8 +89,7 @@
"style": "plain",
"foreground": "#CB4B16",
"properties": {
"prefix": "",
"error_icon": ""
"prefix": ""
}
},
{
Expand Down
3 changes: 1 addition & 2 deletions Themes/jandedobbeleer.json
Expand Up @@ -91,12 +91,11 @@
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"error_icon": "",
"display_exit_code": false,
"always_enabled": true,
"error_color": "#e91e63",
"color_background": true,
"prefix": "<#193549> </>"
"prefix": "<#193549></>"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion Themes/material.json
Expand Up @@ -36,7 +36,7 @@
"style": "plain",
"foreground": "#DCB977",
"properties": {
"error_icon": "",
"prefix": "",
"display_exit_code": false
}
},
Expand Down
2 changes: 1 addition & 1 deletion Themes/paradox.json
Expand Up @@ -71,7 +71,7 @@
"foreground": "#ffffff",
"background": "#ff8080",
"properties": {
"error_icon": ""
"prefix": ""
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion Themes/pararussel.json
Expand Up @@ -37,7 +37,7 @@
"style": "plain",
"foreground": "#DCB977",
"properties": {
"error_icon": "",
"prefix": "",
"display_exit_code": false
}
}
Expand Down
3 changes: 1 addition & 2 deletions Themes/powerlevel10k_classic.json
Expand Up @@ -92,8 +92,7 @@
"style": "plain",
"foreground": "#D4E157",
"properties": {
"prefix": "",
"error_icon": "",
"prefix": "",
"always_enabled": true,
"error_color": "#FF5252",
"display_exit_code": false
Expand Down
2 changes: 1 addition & 1 deletion Themes/powerline.json
Expand Up @@ -64,7 +64,7 @@
"foreground": "#ffffff",
"background": "#ff8080",
"properties": {
"error_icon": ""
"prefix": ""
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion Themes/robbyrussel.json
Expand Up @@ -37,7 +37,7 @@
"style": "plain",
"foreground": "#DCB977",
"properties": {
"error_icon": "",
"prefix": "",
"display_exit_code": false
}
}
Expand Down
2 changes: 1 addition & 1 deletion Themes/sorin.json
Expand Up @@ -9,7 +9,7 @@
"style": "plain",
"foreground": "#CB4B16",
"properties": {
"error_icon": ""
"prefix": ""
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Themes/star.json
Expand Up @@ -47,7 +47,7 @@
"style": "plain",
"foreground": "#C94A16",
"properties": {
"error_icon": "x"
"prefix": "x"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion Themes/zash.json
Expand Up @@ -49,7 +49,7 @@
"style": "plain",
"foreground": "#DCB977",
"properties": {
"error_icon": "",
"prefix": "",
"display_exit_code": false,
"postfix": ""
}
Expand Down
5 changes: 1 addition & 4 deletions segment_exit.go
Expand Up @@ -8,8 +8,6 @@ type exit struct {
}

const (
//ErrorIcon represents icon to display in case of error
ErrorIcon Property = "error_icon"
//DisplayExitCode shows or hides the error code
DisplayExitCode Property = "display_exit_code"
//AlwaysEnabled decides whether or not to always display the exitcode info
Expand All @@ -35,7 +33,6 @@ func (e *exit) init(props *properties, env environmentInfo) {
}

func (e *exit) getFormattedText() string {
errorIcon := e.props.getString(ErrorIcon, "X")
exitCode := e.getMeaningFromExitCode()
colorBackground := e.props.getBool(ColorBackground, false)
if e.env.lastErrorCode() != 0 && !colorBackground {
Expand All @@ -44,7 +41,7 @@ func (e *exit) getFormattedText() string {
if e.env.lastErrorCode() != 0 && colorBackground {
e.props.background = e.props.getColor(ErrorColor, e.props.background)
}
return fmt.Sprintf("%s%s", errorIcon, exitCode)
return exitCode
}

func (e *exit) getMeaningFromExitCode() string {
Expand Down

0 comments on commit 592f414

Please sign in to comment.