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