fix: migrate text correctly

This commit is contained in:
Jan De Dobbeleer 2022-02-02 19:48:50 +01:00 committed by Jan De Dobbeleer
parent b9b789b513
commit 6b6aec43d5
3 changed files with 3 additions and 12 deletions

View file

@ -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

View file

@ -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)

View file

@ -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 {