mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-03 15:27:26 -08:00
parent
016dc50e72
commit
dee6d18baf
|
@ -82,6 +82,9 @@ func (t *Text) cleanTemplate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
knownVariable := func(variable string) bool {
|
knownVariable := func(variable string) bool {
|
||||||
|
if variable == "." {
|
||||||
|
return true
|
||||||
|
}
|
||||||
variable = strings.TrimPrefix(variable, ".")
|
variable = strings.TrimPrefix(variable, ".")
|
||||||
splitted := strings.Split(variable, ".")
|
splitted := strings.Split(variable, ".")
|
||||||
if len(splitted) == 0 {
|
if len(splitted) == 0 {
|
||||||
|
|
|
@ -225,6 +225,11 @@ func TestCleanTemplate(t *testing.T) {
|
||||||
Expected string
|
Expected string
|
||||||
Template string
|
Template string
|
||||||
}{
|
}{
|
||||||
|
{
|
||||||
|
Case: "Literal dot",
|
||||||
|
Expected: "hello . what's up",
|
||||||
|
Template: "hello . what's up",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Case: "Variable",
|
Case: "Variable",
|
||||||
Expected: "{{range $cpu := .Data.CPU}}{{round $cpu.Mhz 2 }} {{end}}",
|
Expected: "{{range $cpu := .Data.CPU}}{{round $cpu.Mhz 2 }} {{end}}",
|
||||||
|
|
Loading…
Reference in a new issue