From 6b6aec43d558bce79a8e87dc165ccc936447581d Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Wed, 2 Feb 2022 19:48:50 +0100 Subject: [PATCH] fix: migrate text correctly --- docs/docs/segment-text.md | 8 -------- src/engine/migrations.go | 3 ++- src/segments/text.go | 4 +--- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/docs/docs/segment-text.md b/docs/docs/segment-text.md index 137e840f..34ac65f4 100644 --- a/docs/docs/segment-text.md +++ b/docs/docs/segment-text.md @@ -36,14 +36,6 @@ New-Alias -Name 'Set-PoshContext' -Value 'Set-EnvVar' -Scope Global -Force ## Template ([info][templates]) -:::note default template - -``` template -{{ .Text }} -``` - -::: - ### Properties - `.Root`: `boolean` - is the current user root/admin or not diff --git a/src/engine/migrations.go b/src/engine/migrations.go index 09f97c93..2cc5411a 100644 --- a/src/engine/migrations.go +++ b/src/engine/migrations.go @@ -43,7 +43,8 @@ func (segment *Segment) migrationOne(env environment.Environment) { delete(segment.Properties, "enable_hyperlink") switch segment.Type { // nolint:exhaustive case TEXT: - segment.migratePropertyValue("text", properties.SegmentTemplate) + segment.migratePropertyKey("text", properties.SegmentTemplate) + segment.migrateTemplate() case GIT: hasTemplate := segment.hasProperty(properties.SegmentTemplate) segment.migratePropertyKey("display_status", segments.FetchStatus) diff --git a/src/segments/text.go b/src/segments/text.go index e16a47f4..6de1ca6e 100644 --- a/src/segments/text.go +++ b/src/segments/text.go @@ -8,12 +8,10 @@ import ( type Text struct { props properties.Properties env environment.Environment - - Text string } func (t *Text) Template() string { - return " {{ .Text }} " + return " " } func (t *Text) Enabled() bool {