mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
parent
d7e289b3bf
commit
f6d0b9e076
|
@ -106,6 +106,7 @@ func (segment *Segment) migrationOne(env environment.Environment) {
|
||||||
segment.migrateTemplate()
|
segment.migrateTemplate()
|
||||||
segment.migrateIconOverride("ssh_icon", "\uf817 ")
|
segment.migrateIconOverride("ssh_icon", "\uf817 ")
|
||||||
template := segment.Properties.GetString(properties.SegmentTemplate, segment.writer.Template())
|
template := segment.Properties.GetString(properties.SegmentTemplate, segment.writer.Template())
|
||||||
|
template = strings.ReplaceAll(template, ".ComputerName", ".HostName")
|
||||||
if !segment.Properties.GetBool(properties.Property("display_host"), true) {
|
if !segment.Properties.GetBool(properties.Property("display_host"), true) {
|
||||||
template = strings.ReplaceAll(template, "@{{ .HostName }}", "")
|
template = strings.ReplaceAll(template, "@{{ .HostName }}", "")
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,6 +310,14 @@ func TestSegmentTemplateMigration(t *testing.T) {
|
||||||
"host_color": "#789012",
|
"host_color": "#789012",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Case: "SESSION - Existing template",
|
||||||
|
Expected: " {{ .UserName }}@{{ .HostName }} ",
|
||||||
|
Type: SESSION,
|
||||||
|
Props: properties.Map{
|
||||||
|
"template": "{{ .UserName }}@{{ .ComputerName }}",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
segment := &Segment{
|
segment := &Segment{
|
||||||
|
|
Loading…
Reference in a new issue