feat(exit): add template properties

This commit is contained in:
Jan De Dobbeleer 2021-11-14 13:39:00 +01:00 committed by Jan De Dobbeleer
parent f5aeed466e
commit f850f3b805
49 changed files with 272 additions and 251 deletions

View file

@ -344,23 +344,36 @@ This means that for user Bill, who has a user account `Bill` on Windows and `bil
{
"type": "git",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#193549",
"background": "#ffeb3b"
"foreground_templates": [
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#ffffff{{ end }}"
],
"background": "#2e9599",
"background_templates": [
"{{ if or (.Working.Changed) (.Staging.Changed) }}#f36943{{ end }}",
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}#a8216b{{ end }}",
"{{ if gt .Ahead 0 }}#35b5ff{{ end }}",
"{{ if gt .Behind 0 }}#f89cfa{{ end }}"
],
"powerline_symbol": "\uE0B0",
"properties": {
"fetch_status": true,
"branch_max_length": 25,
"template": "{{ .HEAD }}{{ .BranchStatus }}"
}
},
{
"type": "exit",
"style": "diamond",
"foreground": "#ffffff",
"background": "#00897b",
"background_templates": ["{{ if gt .Code 0 }}#e91e63{{ end }}"],
"leading_diamond": "",
"trailing_diamond": "\uE0B4",
"properties": {
"display_exit_code": false,
"always_enabled": true,
"error_color": "#e91e63",
"color_background": true,
"prefix": "<#193549>\uE0B0 \uE23A</>"
"template": "\uE23A",
"prefix": "<parentBackground>\uE0B0</> "
}
}
]

View file

@ -16,26 +16,26 @@ Displays the last exit code or that the last command failed based on the configu
"style": "diamond",
"foreground": "#ffffff",
"background": "#00897b",
"background_templates": [
"{{ if gt .Code 0 }}#e91e63{{ end }}",
],
"leading_diamond": "",
"trailing_diamond": "\uE0B4",
"properties": {
"display_exit_code": false,
"always_enabled": true,
"error_color": "#e91e63",
"color_background": true,
"prefix": "<#193549>\uE0B0</> \uE23A"
"template": "\uE23A",
"prefix": "<#193549>\uE0B0</> "
}
}
```
## Properties
- display_exit_code: `boolean` - show or hide the exit code - defaults to `true`
- always_enabled: `boolean` - always show the status - defaults to `false`
- color_background: `boolean` - color the background or foreground when an error occurs - defaults to `false`
- error_color: `string` [color][colors] - color to use when an error occurred
- always_numeric: `boolean` - always display exit code as a number - defaults to `false`
- success_icon: `string` - displays when there's no error and `"always_enabled": true` - defaults to `""`
- error_icon: `string` - displays when there's an error - defaults to `""`
[colors]: /docs/config-colors
## Template Properties
- `.Code`: `number` - the last known exit code
- `.Text`: `string` - the textual meaning linked to exit code (if applicable, otherwise identical to `.Code`)

View file

@ -6,6 +6,8 @@ import (
"strings"
)
// GIT Segement
const (
// DisplayStatus shows the status of the repository
DisplayStatus Property = "display_status"
@ -15,7 +17,6 @@ const (
DisplayWorktreeCount Property = "display_worktree_count"
// DisplayUpstreamIcon show or hide the upstream icon
DisplayUpstreamIcon Property = "display_upstream_icon"
// LocalWorkingIcon the icon to use as the local working area changes indicator
LocalWorkingIcon Property = "local_working_icon"
// LocalStagingIcon the icon to use as the local staging area changes indicator
@ -52,7 +53,7 @@ func (g *git) getBool(property, legacyProperty Property) bool {
return g.props.getBool(property, false)
}
func (g *git) renderDeprecatedString(statusColorsEnabled bool) string {
func (g *git) deprecatedString(statusColorsEnabled bool) string {
if statusColorsEnabled {
g.SetStatusColor()
}
@ -129,3 +130,39 @@ func (g *git) colorStatusString(prefix, status, color string) string {
}
return fmt.Sprintf("<%s>%s %s</>", color, prefix, status)
}
// EXIT Segment
const (
// DisplayExitCode shows or hides the error code
DisplayExitCode Property = "display_exit_code"
// ErrorColor specify a different foreground color for the error text when using always_show = true
ErrorColor Property = "error_color"
// AlwaysNumeric shows error codes as numbers
AlwaysNumeric Property = "always_numeric"
// SuccessIcon displays when there's no error and AlwaysEnabled = true
SuccessIcon Property = "success_icon"
// ErrorIcon displays when there's an error
ErrorIcon Property = "error_icon"
)
func (e *exit) deprecatedString() string {
colorBackground := e.props.getBool(ColorBackground, false)
if e.Code != 0 && !colorBackground {
e.props.foreground = e.props.getColor(ErrorColor, e.props.foreground)
}
if e.Code != 0 && colorBackground {
e.props.background = e.props.getColor(ErrorColor, e.props.background)
}
if e.Code == 0 {
return e.props.getString(SuccessIcon, "")
}
errorIcon := e.props.getString(ErrorIcon, "")
if !e.props.getBool(DisplayExitCode, true) {
return errorIcon
}
if e.props.getBool(AlwaysNumeric, false) {
return fmt.Sprintf("%s%d", errorIcon, e.Code)
}
return fmt.Sprintf("%s%s", errorIcon, e.Text)
}

View file

@ -6,6 +6,8 @@ import (
"github.com/stretchr/testify/assert"
)
// GIT Segment
func TestGetStatusDetailStringDefault(t *testing.T) {
expected := "icon +1"
status := &GitStatus{
@ -257,3 +259,45 @@ func TestStatusColorsWithoutDisplayStatus(t *testing.T) {
g.string()
assert.Equal(t, expected, g.props.background)
}
// EXIT Segement
func TestExitWriterDeprecatedString(t *testing.T) {
cases := []struct {
ExitCode int
Expected string
SuccessIcon string
ErrorIcon string
DisplayExitCode bool
AlwaysNumeric bool
}{
{ExitCode: 129, Expected: "SIGHUP", DisplayExitCode: true},
{ExitCode: 5001, Expected: "5001", DisplayExitCode: true},
{ExitCode: 147, Expected: "SIGSTOP", DisplayExitCode: true},
{ExitCode: 147, Expected: "", DisplayExitCode: false},
{ExitCode: 147, Expected: "147", DisplayExitCode: true, AlwaysNumeric: true},
{ExitCode: 0, Expected: "wooopie", SuccessIcon: "wooopie"},
{ExitCode: 129, Expected: "err SIGHUP", ErrorIcon: "err ", DisplayExitCode: true},
{ExitCode: 129, Expected: "err", ErrorIcon: "err", DisplayExitCode: false},
}
for _, tc := range cases {
env := new(MockedEnvironment)
env.On("lastErrorCode", nil).Return(tc.ExitCode)
props := &properties{
foreground: "#111111",
background: "#ffffff",
values: map[Property]interface{}{
SuccessIcon: tc.SuccessIcon,
ErrorIcon: tc.ErrorIcon,
DisplayExitCode: tc.DisplayExitCode,
AlwaysNumeric: tc.AlwaysNumeric,
},
}
e := &exit{
env: env,
props: props,
}
assert.Equal(t, tc.Expected, e.string())
}
}

View file

@ -1,24 +1,14 @@
package main
import "fmt"
import "strconv"
type exit struct {
props *properties
env environmentInfo
}
const (
// DisplayExitCode shows or hides the error code
DisplayExitCode Property = "display_exit_code"
// ErrorColor specify a different foreground color for the error text when using always_show = true
ErrorColor Property = "error_color"
// AlwaysNumeric shows error codes as numbers
AlwaysNumeric Property = "always_numeric"
// SuccessIcon displays when there's no error and AlwaysEnabled = true
SuccessIcon Property = "success_icon"
// ErrorIcon displays when there's an error
ErrorIcon Property = "error_icon"
)
Code int
Text string
}
func (e *exit) enabled() bool {
if e.props.getBool(AlwaysEnabled, false) {
@ -37,28 +27,26 @@ func (e *exit) init(props *properties, env environmentInfo) {
}
func (e *exit) getFormattedText() string {
exitCode := e.getMeaningFromExitCode()
colorBackground := e.props.getBool(ColorBackground, false)
if e.env.lastErrorCode() != 0 && !colorBackground {
e.props.foreground = e.props.getColor(ErrorColor, e.props.foreground)
e.Code = e.env.lastErrorCode()
e.Text = e.getMeaningFromExitCode()
segmentTemplate := e.props.getString(SegmentTemplate, "")
if len(segmentTemplate) == 0 {
return e.deprecatedString()
}
if e.env.lastErrorCode() != 0 && colorBackground {
e.props.background = e.props.getColor(ErrorColor, e.props.background)
template := &textTemplate{
Template: segmentTemplate,
Context: e,
Env: e.env,
}
if e.env.lastErrorCode() == 0 {
return e.props.getString(SuccessIcon, "")
text, err := template.render()
if err != nil {
return err.Error()
}
return fmt.Sprintf("%s%s", e.props.getString(ErrorIcon, ""), exitCode)
return text
}
func (e *exit) getMeaningFromExitCode() string {
if !e.props.getBool(DisplayExitCode, true) {
return ""
}
if e.props.getBool(AlwaysNumeric, false) {
return fmt.Sprintf("%d", e.env.lastErrorCode())
}
switch e.env.lastErrorCode() {
switch e.Code {
case 1:
return "ERROR"
case 2:
@ -112,6 +100,6 @@ func (e *exit) getMeaningFromExitCode() string {
case 128 + 22:
return "SIGTTOU"
default:
return fmt.Sprintf("%d", e.env.lastErrorCode())
return strconv.Itoa(e.Code)
}
}

View file

@ -26,46 +26,6 @@ func TestExitWriterEnabled(t *testing.T) {
}
}
func TestExitWriterFormattedText(t *testing.T) {
cases := []struct {
ExitCode int
Expected string
SuccessIcon string
ErrorIcon string
DisplayExitCode bool
AlwaysNumeric bool
}{
{ExitCode: 129, Expected: "SIGHUP", DisplayExitCode: true},
{ExitCode: 5001, Expected: "5001", DisplayExitCode: true},
{ExitCode: 147, Expected: "SIGSTOP", DisplayExitCode: true},
{ExitCode: 147, Expected: "", DisplayExitCode: false},
{ExitCode: 147, Expected: "147", DisplayExitCode: true, AlwaysNumeric: true},
{ExitCode: 0, Expected: "wooopie", SuccessIcon: "wooopie"},
{ExitCode: 129, Expected: "err SIGHUP", ErrorIcon: "err ", DisplayExitCode: true},
{ExitCode: 129, Expected: "err", ErrorIcon: "err", DisplayExitCode: false},
}
for _, tc := range cases {
env := new(MockedEnvironment)
env.On("lastErrorCode", nil).Return(tc.ExitCode)
props := &properties{
foreground: "#111111",
background: "#ffffff",
values: map[Property]interface{}{
SuccessIcon: tc.SuccessIcon,
ErrorIcon: tc.ErrorIcon,
DisplayExitCode: tc.DisplayExitCode,
AlwaysNumeric: tc.AlwaysNumeric,
},
}
e := &exit{
env: env,
props: props,
}
assert.Equal(t, tc.Expected, e.getFormattedText())
}
}
func TestGetMeaningFromExitCode(t *testing.T) {
errorMap := make(map[int]string)
errorMap[1] = "ERROR"
@ -97,26 +57,34 @@ func TestGetMeaningFromExitCode(t *testing.T) {
errorMap[151] = "151"
errorMap[7000] = "7000"
for exitcode, want := range errorMap {
env := new(MockedEnvironment)
env.On("lastErrorCode", nil).Return(exitcode)
e := &exit{
env: env,
}
e := &exit{}
e.Code = exitcode
assert.Equal(t, want, e.getMeaningFromExitCode())
}
}
func TestAlwaysNumericExitCode(t *testing.T) {
env := new(MockedEnvironment)
env.On("lastErrorCode", nil).Return(1)
props := &properties{
values: map[Property]interface{}{
AlwaysNumeric: true,
},
func TestExitWriterTemplateString(t *testing.T) {
cases := []struct {
Case string
ExitCode int
Expected string
Template string
}{
{Case: "Only code", ExitCode: 129, Expected: "129", Template: "{{ .Code }}"},
}
e := &exit{
env: env,
props: props,
for _, tc := range cases {
env := new(MockedEnvironment)
env.On("lastErrorCode", nil).Return(tc.ExitCode)
props := &properties{
values: map[Property]interface{}{
SegmentTemplate: tc.Template,
},
}
e := &exit{
env: env,
props: props,
}
assert.Equal(t, tc.Expected, e.string(), tc.Case)
}
assert.Equal(t, "1", e.getMeaningFromExitCode())
}

View file

@ -206,7 +206,7 @@ func (g *git) string() string {
}
// legacy render string if no template
// remove this for 6.0
return g.renderDeprecatedString(statusColorsEnabled)
return g.deprecatedString(statusColorsEnabled)
}
func (g *git) templateString(segmentTemplate string) string {

View file

@ -57,7 +57,10 @@
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#ff8080"
"background": "#ff8080",
"properties": {
"template": "{{ .Text }}"
}
}
]
}

View file

@ -33,7 +33,8 @@
"style": "plain",
"foreground": "#C94A16",
"properties": {
"prefix": "x"
"template": "x{{ .Text }}",
"prefix": ""
}
}
]

View file

@ -81,7 +81,8 @@
"foreground": "#ffffff",
"background": "#910000",
"properties": {
"prefix": "<transparent> \uF12A</> "
"prefix": "<transparent> \uF12A</> ",
"template": "{{ .Text }}"
}
}
]
@ -124,11 +125,11 @@
"type": "exit",
"style": "plain",
"foreground": "#ffffff",
"foreground_templates": ["{{ if gt .Code 0 }}#ff0000{{ end }}"],
"properties": {
"prefix": "\u276F",
"always_enabled": true,
"error_color": "#ff0000",
"display_exit_code": false
"template": "\u276F",
"prefix": "",
"always_enabled": true
}
}
]

View file

@ -95,14 +95,12 @@
"style": "diamond",
"foreground": "#ffffff",
"background": "#007800",
"leading_diamond": "<transparent, #007800>\uE0B0</>",
"background_templates": ["{{ if gt .Code 0 }}#f1184c{{ end }}"],
"leading_diamond": "<transparent,background>\uE0B0</>",
"trailing_diamond": "\uE0b0",
"properties": {
"display_exit_code": false,
"always_enabled": true,
"error_color": "#f1184c",
"color_background": true,
"prefix": " \ufc8d"
"template": "\ufc8d",
"always_enabled": true
}
}
]

View file

@ -52,12 +52,10 @@
"trailing_diamond": "\uE0B4",
"foreground": "#ffffff",
"background": "#491515",
"background_templates": ["{{ if gt .Code 0 }}#f1184c{{ end }}"],
"properties": {
"display_exit_code": false,
"always_enabled": true,
"error_color": "#f1184c",
"color_background": true,
"prefix": " \uF7d4"
"template": "\uF7d4",
"always_enabled": true
}
}
]

View file

@ -95,11 +95,9 @@
"powerline_symbol": "\uE0B4",
"foreground": "#242424",
"background": "#33DD2D",
"background_templates": ["{{ if gt .Code 0 }}#f1184c{{ end }}"],
"properties": {
"display_exit_code": false,
"color_background": true,
"error_color": "#f1184c",
"prefix": " \ufc8d"
"template": "\uF7d4"
}
}
]

View file

@ -40,6 +40,7 @@
"style": "plain",
"foreground": "#ffffff",
"properties": {
"template": "{{ .Text }}",
"prefix": "<#CB4B16>[x</>",
"postfix": "<#CB4B16>]</>"
}

View file

@ -44,7 +44,8 @@
"style": "plain",
"foreground": "#C94A16",
"properties": {
"prefix": "x"
"template": "x{{ .Text }}",
"prefix": ""
}
},
{

View file

@ -10,6 +10,7 @@
"style": "plain",
"foreground": "#ffffff",
"properties": {
"template": "{{ .Text }}",
"postfix": ""
}
},

View file

@ -75,14 +75,12 @@
"style": "diamond",
"foreground": "#ffffff",
"background": "#2e9599",
"leading_diamond": "<transparent, #2e9599>\uE0B0</>",
"background_templates": ["{{ if gt .Code 0 }}#f1184c{{ end }}"],
"leading_diamond": "<transparent,background>\uE0B0</>",
"trailing_diamond": "\uE0B4",
"properties": {
"display_exit_code": false,
"always_enabled": true,
"error_color": "#f1184c",
"color_background": true,
"prefix": " \uFC0C"
"template": "\uF7d4",
"always_enabled": true
}
}
]

View file

@ -76,7 +76,10 @@
{
"type": "exit",
"style": "plain",
"foreground": "#CB4B16"
"foreground": "#CB4B16",
"properties": {
"template": "{{ .Text }}"
}
},
{
"type": "text",

View file

@ -69,12 +69,10 @@
"powerline_symbol": "\uE0B0",
"foreground": "#242424",
"background": "#33DD2D",
"background_templates": ["{{ if gt .Code 0 }}#f1184c{{ end }}"],
"properties": {
"display_exit_code": false,
"always_enabled": true,
"color_background": true,
"error_color": "#f1184c",
"prefix": " \ufc8d"
"template": "\ufc8d",
"always_enabled": true
}
}
]

View file

@ -162,15 +162,14 @@
"type": "exit",
"style": "diamond",
"foreground": "#ffffff",
"background": "#2e9599",
"background": "#00897b",
"background_templates": ["{{ if gt .Code 0 }}#e91e63{{ end }}"],
"leading_diamond": "",
"trailing_diamond": "",
"trailing_diamond": "\uE0B4",
"properties": {
"display_exit_code": false,
"always_enabled": true,
"error_color": "#f1184c",
"color_background": true,
"prefix": "<#83769c>\uE0B0</> "
"template": "\uE23A",
"prefix": "<parentBackground>\uE0B0</> "
}
}
]

View file

@ -92,8 +92,9 @@
{
"background": "#910000",
"foreground": "#ffffff",
"leading_diamond": "<transparent,#910000>\uE0B0</>",
"leading_diamond": "<transparent,background>\uE0B0</>",
"properties": {
"template": "{{ .Text }}",
"prefix": "<transparent> \uF12A</> "
},
"style": "diamond",

View file

@ -45,14 +45,13 @@
"style": "diamond",
"foreground": "#ffffff",
"background": "#4707a8",
"background_templates": ["{{ if gt .Code 0 }}#f1184c{{ end }}"],
"leading_diamond": "",
"trailing_diamond": "\uE0B4",
"properties": {
"display_exit_code": false,
"template": " \uE23A",
"always_enabled": true,
"error_color": "#f1184c",
"color_background": true,
"prefix": "<transparent>\uE0B0</> \uE23A"
"prefix": "<transparent>\uE0B0</>"
}
}
]

View file

@ -99,13 +99,10 @@
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#4caf50",
"background_templates": [],
"background_templates": ["{{ if gt .Code 0 }}red{{ end }}"],
"properties": {
"always_enabled": true,
"success_icon": "\uf469 \u2665 ",
"color_background": true,
"error_icon": "\uf525 ",
"error_color": "red"
"template": "{{ if gt .Code 0 }}\uf525{{ else }}\uf469 \u2665{{ end }} "
}
}
]

View file

@ -48,13 +48,11 @@
{
"background": "#0095e9",
"foreground": "#ffffff",
"leading_diamond": "<transparent, #0095e9>\uE0B0</>",
"background_templates": ["{{ if gt .Code 0 }}#ff0044{{ end }}"],
"leading_diamond": "<transparent,background>\uE0B0</>",
"properties": {
"always_enabled": true,
"color_background": true,
"display_exit_code": false,
"error_color": "#ff0044",
"prefix": " "
"template": ""
},
"style": "diamond",
"trailing_diamond": "",

View file

@ -40,8 +40,9 @@
"style": "plain",
"foreground": "#DCB977",
"properties": {
"prefix": "\uF119",
"display_exit_code": false
"template": "\uF119",
"prefix": " ",
"postfix": ""
}
},
{

View file

@ -77,12 +77,10 @@
"powerline_symbol": "\uE0B0",
"foreground": "#242424",
"background": "#33DD2D",
"background_templates": ["{{ if gt .Code 0 }}#f1184c{{ end }}"],
"properties": {
"display_exit_code": false,
"always_enabled": true,
"color_background": true,
"error_color": "#f1184c",
"prefix": " \ufc8d"
"template": "\ufc8d"
}
}
]

View file

@ -103,10 +103,8 @@
"style": "plain",
"foreground": "#ffffff",
"properties": {
"display_exit_code": false,
"always_enabled": true,
"success_icon": "<#00ff00>\uF633</>",
"error_icon": "<#ff0000>\uF659</>"
"template": "{{ if gt .Code 0 }}\uF659{{ else }}\uF633{{ end }}"
}
},
{

View file

@ -107,11 +107,11 @@
"type": "exit",
"style": "powerline",
"foreground": "lightGreen",
"foreground_templates": ["{{ if gt .Code 0 }}red{{ end }}"],
"properties": {
"display_exit_code": false,
"always_enabled": true,
"error_color": "red",
"prefix": "\u279c"
"template": "\u279c",
"prefix": ""
}
}
]

View file

@ -290,11 +290,11 @@
"type": "exit",
"style": "plain",
"foreground": "#22da6e",
"foreground_templates": ["{{ if gt .Code 0 }}#ef5350{{ end }}"],
"properties": {
"prefix": "\ue285\ue285",
"display_exit_code": false,
"always_enabled": true,
"error_color": "#ef5350"
"template": "\ue285\ue285",
"prefix": "",
"always_enabled": true
}
}
]

View file

@ -73,9 +73,7 @@
"foreground": "#ffffff",
"background": "#ff4040",
"properties": {
"display_exit_code": false,
"always_enabled": false,
"prefix": " \ue70f"
"template": "\ue70f"
}
},
{

View file

@ -58,7 +58,7 @@
"foreground": "#ffffff",
"background": "#ff8080",
"properties": {
"prefix": " \uE20F"
"template": "\uE20F"
}
}
]

View file

@ -39,8 +39,8 @@
"style": "plain",
"foreground": "#DCB977",
"properties": {
"prefix": "\uF119",
"display_exit_code": false
"template": "\uF119",
"prefix": " "
}
}
]

View file

@ -78,13 +78,12 @@
"style": "plain",
"foreground": "#ffffff",
"background": "#2e9599",
"background_templates": ["{{ if gt .Code 0 }}#f1184c{{ end }}"],
"properties": {
"display_exit_code": false,
"always_enabled": true,
"error_color": "#f1184c",
"color_background": true,
"prefix": "<transparent>\uE0B0</> \uE23A ",
"postfix": "<#2e9599,transparent>\uE0B4</>"
"template": " \uE23A ",
"prefix": "<transparent>\uE0B0</>",
"postfix": "<background,transparent>\uE0B4</>"
}
}
]

View file

@ -88,11 +88,11 @@
"type": "exit",
"style": "plain",
"foreground": "#D4E157",
"foreground_templates": ["{{ if gt .Code 0 }}#FF5252{{ end }}"],
"properties": {
"prefix": "\u276F",
"always_enabled": true,
"error_color": "#FF5252",
"display_exit_code": false
"template": "\u276F",
"prefix": "",
"always_enabled": true
}
}
]

View file

@ -94,11 +94,11 @@
"type": "exit",
"style": "plain",
"foreground": "#D4E157",
"foreground_templates": ["{{ if gt .Code 0 }}#FF5252{{ end }}"],
"properties": {
"prefix": "\u276F",
"always_enabled": true,
"error_color": "#FF5252",
"display_exit_code": false
"template": "\u276F",
"prefix": "",
"always_enabled": true
}
}
]

View file

@ -170,12 +170,11 @@
"invert_powerline": true,
"foreground": "#d3d7cf",
"background": "#000000",
"background_templates": ["{{ if gt .Code 0 }}#cc2222{{ end }}"],
"properties": {
"prefix": " ",
"always_enabled": true,
"display_exit_code": true,
"error_color": "#cc2222",
"color_background": true,
"success_icon": "✔"
"template": "{{ if gt .Code 0 }}{{ .Text }}{{ else }}✔{{ end }}"
}
},
{

View file

@ -52,7 +52,7 @@
"foreground": "#ffffff",
"background": "#ff8080",
"properties": {
"prefix": "\uE20F"
"template": "\uE20F"
}
}
]

View file

@ -77,10 +77,10 @@
"type": "exit",
"style": "plain",
"foreground": "#B48EAD",
"foreground_templates": ["{{ if gt .Code 0 }}#BF616A{{ end }}"],
"properties": {
"prefix": "\u276f",
"display_exit_code": false,
"error_color": "#BF616A",
"template": "\u276f",
"prefix": "",
"always_enabled": true
}
}

View file

@ -37,10 +37,11 @@
{
"type": "exit",
"style": "plain",
"foreground": "#DCB977",
"foreground": "#BF616A",
"properties": {
"prefix": "\u2717",
"display_exit_code": false
"template": "\u2717",
"prefix": " ",
"postfix": ""
}
}
]

View file

@ -473,30 +473,14 @@
"properties": {
"properties": {
"properties": {
"display_exit_code": {
"type": "boolean",
"title": "Display Exit Code",
"description": "Show or hide the exit code",
"default": true
},
"always_enabled": {
"type": "boolean",
"title": "Always Enabled",
"description": "Always show the status",
"default": false
},
"color_background": {
"type": "boolean",
"title": "Color Background",
"description": "Color the background or foreground",
"default": false
},
"error_color": { "$ref": "#/definitions/color" },
"always_numeric": {
"type": "boolean",
"title": "Always Numeric",
"description": "Always display the exit code as a number",
"default": false
"template": {
"$ref": "#/definitions/template"
}
}
}
@ -1610,6 +1594,9 @@
"properties": {
"properties": {
"properties": {
"template": {
"$ref": "#/definitions/template"
},
"always_enabled": {
"type": "boolean",
"title": "Always Enabled",

View file

@ -207,13 +207,10 @@
"type": "exit",
"style": "plain",
"foreground": "#9FD356",
"foreground_templates": ["{{ if gt .Code 0 }}#E84855{{ end }}"],
"properties": {
"display_exit_code": true,
"always_numeric": true,
"always_enabled": true,
"error_color": "#E84855",
"color_background": false,
"prefix": " \uf705 "
"template": "\uf705 {{ if gt .Code 0 }}{{ .Code }}{{ end }}"
}
}
]

View file

@ -203,13 +203,10 @@
"type": "exit",
"style": "plain",
"foreground": "#9FD356",
"foreground_templates": ["{{ if gt .Code 0 }}#E84855{{ end }}"],
"properties": {
"display_exit_code": true,
"always_numeric": true,
"always_enabled": true,
"error_color": "#E84855",
"color_background": false,
"prefix": " \uf705 "
"template": "\uf705 {{ if gt .Code 0 }}{{ .Code }}{{ end }}"
}
}
]

View file

@ -8,7 +8,10 @@
{
"type": "exit",
"style": "plain",
"foreground": "#CB4B16"
"foreground": "#CB4B16",
"properties": {
"template": "{{ .Text }}"
}
},
{
"type": "root",

View file

@ -48,8 +48,8 @@
"style": "plain",
"foreground": "#C94A16",
"properties": {
"prefix": "x",
"display_exit_code": false
"prefix": "",
"template": "x"
}
}
]

View file

@ -107,10 +107,7 @@
"foreground": "#ffffff",
"background": "#ff8080",
"properties": {
"display_exit_code": false,
"prefix": " ",
"postfix": " ",
"error_icon": "error"
"template": "error"
}
}
]

View file

@ -104,11 +104,11 @@
"type": "exit",
"style": "powerline",
"foreground": "lightGreen",
"foreground_templates": ["{{ if gt .Code 0 }}red{{ end }}"],
"properties": {
"display_exit_code": false,
"always_enabled": true,
"error_color": "red",
"prefix": "\u279c"
"template": "\u279c",
"prefix": ""
}
}
]

View file

@ -44,10 +44,12 @@
{
"type": "exit",
"style": "plain",
"foreground": "#7FFFD4",
"foreground_templates": ["{{ if gt .Code 0 }}#E84855{{ end }}"],
"properties": {
"display_exit_code": false,
"always_enabled": true,
"prefix": "<#66CDAA>\u276F</><#76EEC6>\u276F</><#7FFFD4>\u276F</>"
"template": "<#66CDAA>\u276F</><#76EEC6>\u276F</><foreground>\u276F</>",
"prefix": ""
}
}
]

View file

@ -80,7 +80,7 @@
"style": "plain",
"foreground": "red",
"properties": {
"prefix": " C:",
"template": "C:{{ if gt .Code 0 }}{{ .Code }}{{ end }}",
"always_numeric": true
}
}

View file

@ -50,8 +50,7 @@
"style": "plain",
"foreground": "#DCB977",
"properties": {
"prefix": "\uF119",
"display_exit_code": false,
"template": "\uF119",
"postfix": ""
}
}