mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-02 05:41:10 -08:00
refactor(segment): remove templates
BREAKING CHANGE: with templates being removed, this need to be a single template element now
This commit is contained in:
parent
724d25b4ee
commit
42b776be36
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
|
@ -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",
|
||||||
|
|
Loading…
Reference in a new issue