mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-26 19:39:39 -08:00
parent
35aead22fc
commit
06291e168b
|
@ -127,6 +127,10 @@ func (segment *Segment) migrationOne(env environment.Environment) {
|
|||
}
|
||||
case EXIT:
|
||||
template := segment.Properties.GetString(properties.SegmentTemplate, segment.writer.Template())
|
||||
if strings.Contains(template, ".Text") {
|
||||
template = strings.ReplaceAll(template, ".Text", ".Meaning")
|
||||
segment.Properties[properties.SegmentTemplate] = template
|
||||
}
|
||||
alwaysNumeric := properties.Property("always_numeric")
|
||||
if segment.Properties.GetBool(alwaysNumeric, false) {
|
||||
delete(segment.Properties, alwaysNumeric)
|
||||
|
|
|
@ -239,6 +239,14 @@ func TestSegmentTemplateMigration(t *testing.T) {
|
|||
"error_icon": "FAIL",
|
||||
},
|
||||
},
|
||||
{
|
||||
Case: "EXIT - .Text",
|
||||
Expected: " {{ .Meaning }} ",
|
||||
Type: EXIT,
|
||||
Props: properties.Map{
|
||||
"template": "{{ .Text }}",
|
||||
},
|
||||
},
|
||||
{
|
||||
Case: "BATTERY",
|
||||
Expected: ` {{ if not .Error }}{{ $stateList := list "Discharging" "Full" }}{{ if has .State.String $stateList }}{{ .Icon }}{{ .Percentage }}{{ end }}{{ end }}{{ .Error }} `,
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
"foreground": "#ffffff",
|
||||
"powerline_symbol": "\ue0b0",
|
||||
"properties": {
|
||||
"template": " {{ .Text }} "
|
||||
"template": " {{ .Meaning }} "
|
||||
},
|
||||
"style": "powerline",
|
||||
"type": "exit"
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
{
|
||||
"foreground": "#C94A16",
|
||||
"properties": {
|
||||
"template": "x{{ .Text }} "
|
||||
"template": "x{{ .Meaning }} "
|
||||
},
|
||||
"style": "plain",
|
||||
"type": "exit"
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
"foreground": "#ffffff",
|
||||
"powerline_symbol": "\ue0b0",
|
||||
"properties": {
|
||||
"template": "<transparent> \uf12a</> {{ .Text }} "
|
||||
"template": "<transparent> \uf12a</> {{ .Meaning }} "
|
||||
},
|
||||
"style": "powerline",
|
||||
"type": "exit"
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
{
|
||||
"foreground": "#ffffff",
|
||||
"properties": {
|
||||
"template": "<#CB4B16>[x</>{{ .Text }}<#CB4B16>]</>"
|
||||
"template": "<#CB4B16>[x</>{{ .Meaning }}<#CB4B16>]</>"
|
||||
},
|
||||
"style": "plain",
|
||||
"type": "exit"
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
{
|
||||
"foreground": "#C94A16",
|
||||
"properties": {
|
||||
"template": "x{{ .Text }} "
|
||||
"template": "x{{ .Meaning }} "
|
||||
},
|
||||
"style": "plain",
|
||||
"type": "exit"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
{
|
||||
"foreground": "#ffffff",
|
||||
"properties": {
|
||||
"template": " {{ .Text }}"
|
||||
"template": " {{ .Meaning }}"
|
||||
},
|
||||
"style": "plain",
|
||||
"type": "exit"
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
{
|
||||
"foreground": "#CB4B16",
|
||||
"properties": {
|
||||
"template": " {{ .Text }} "
|
||||
"template": " {{ .Meaning }} "
|
||||
},
|
||||
"style": "plain",
|
||||
"type": "exit"
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
"foreground": "#ffffff",
|
||||
"leading_diamond": "<transparent,background>\ue0b0</>",
|
||||
"properties": {
|
||||
"template": "<transparent> \uf12a</> {{ .Text }} "
|
||||
"template": "<transparent> \uf12a</> {{ .Meaning }} "
|
||||
},
|
||||
"style": "diamond",
|
||||
"trailing_diamond": "\ue0b0",
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
{
|
||||
"foreground": "#d8dee9",
|
||||
"properties": {
|
||||
"template": "<#5e81ac>[x</>{{ .Text }}<#5e81ac>]</>"
|
||||
"template": "<#5e81ac>[x</>{{ .Meaning }}<#5e81ac>]</>"
|
||||
},
|
||||
"style": "plain",
|
||||
"type": "exit"
|
||||
|
|
|
@ -174,7 +174,7 @@
|
|||
"powerline_symbol": "\ue0b2",
|
||||
"properties": {
|
||||
"always_enabled": true,
|
||||
"template": " {{ if gt .Code 0 }}{{ .Text }}{{ else }}\u2714{{ end }} "
|
||||
"template": " {{ if gt .Code 0 }}{{ .Meaning }}{{ else }}\u2714{{ end }} "
|
||||
},
|
||||
"style": "powerline",
|
||||
"type": "exit"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
{
|
||||
"foreground": "#CB4B16",
|
||||
"properties": {
|
||||
"template": " {{ .Text }} "
|
||||
"template": " {{ .Meaning }} "
|
||||
},
|
||||
"style": "plain",
|
||||
"type": "exit"
|
||||
|
|
Loading…
Reference in a new issue