refactor(segment): remove templates

BREAKING CHANGE: with templates being removed, this need to be a single template element now
This commit is contained in:
Jan De Dobbeleer 2024-10-11 21:45:51 +02:00 committed by Jan De Dobbeleer
parent 724d25b4ee
commit 42b776be36
2 changed files with 0 additions and 12 deletions

View file

@ -58,7 +58,6 @@ type Segment struct {
LeadingPowerlineSymbol string `json:"leading_powerline_symbol,omitempty" toml:"leading_powerline_symbol,omitempty"` LeadingPowerlineSymbol string `json:"leading_powerline_symbol,omitempty" toml:"leading_powerline_symbol,omitempty"`
ForegroundTemplates template.List `json:"foreground_templates,omitempty" toml:"foreground_templates,omitempty"` ForegroundTemplates template.List `json:"foreground_templates,omitempty" toml:"foreground_templates,omitempty"`
Tips []string `json:"tips,omitempty" toml:"tips,omitempty"` Tips []string `json:"tips,omitempty" toml:"tips,omitempty"`
Templates template.List `json:"templates,omitempty" toml:"templates,omitempty"`
BackgroundTemplates template.List `json:"background_templates,omitempty" toml:"background_templates,omitempty"` BackgroundTemplates template.List `json:"background_templates,omitempty" toml:"background_templates,omitempty"`
MinWidth int `json:"min_width,omitempty" toml:"min_width,omitempty"` MinWidth int `json:"min_width,omitempty" toml:"min_width,omitempty"`
MaxWidth int `json:"max_width,omitempty" toml:"max_width,omitempty"` MaxWidth int `json:"max_width,omitempty" toml:"max_width,omitempty"`
@ -247,13 +246,6 @@ func (segment *Segment) SetText() {
} }
func (segment *Segment) string() string { func (segment *Segment) string() string {
if !segment.Templates.Empty() {
templatesResult := segment.Templates.Resolve(segment.writer, "", segment.TemplatesLogic)
if len(segment.Template) == 0 {
return templatesResult
}
}
if len(segment.Template) == 0 { if len(segment.Template) == 0 {
segment.Template = segment.writer.Template() segment.Template = segment.writer.Template()
} }

View file

@ -430,10 +430,6 @@
"description": "https://ohmyposh.dev/docs/configuration/templates", "description": "https://ohmyposh.dev/docs/configuration/templates",
"default": "" "default": ""
}, },
"templates": {
"$ref": "#/definitions/templates",
"description": "https://ohmyposh.dev/docs/configuration/segment"
},
"templates_logic": { "templates_logic": {
"type": "string", "type": "string",
"title": "Templates Logic", "title": "Templates Logic",