mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-02 05:41:10 -08:00
fix(yaml): try int parsing before fallback
json and yaml returns 2 different types float64 vs int
This commit is contained in:
parent
dc8db5dd25
commit
fe3bab8e8a
|
@ -89,12 +89,17 @@ func (p properties) getFloat64(property Property, defaultValue float64) float64
|
||||||
return defaultValue
|
return defaultValue
|
||||||
}
|
}
|
||||||
|
|
||||||
floatValue, ok := val.(float64)
|
if floatValue, ok := val.(float64); ok {
|
||||||
|
return floatValue
|
||||||
|
}
|
||||||
|
|
||||||
|
// config parser parses an int
|
||||||
|
intValue, ok := val.(int)
|
||||||
if !ok {
|
if !ok {
|
||||||
return defaultValue
|
return defaultValue
|
||||||
}
|
}
|
||||||
|
|
||||||
return floatValue
|
return float64(intValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p properties) getInt(property Property, defaultValue int) int {
|
func (p properties) getInt(property Property, defaultValue int) int {
|
||||||
|
@ -107,7 +112,7 @@ func (p properties) getInt(property Property, defaultValue int) int {
|
||||||
return intValue
|
return intValue
|
||||||
}
|
}
|
||||||
|
|
||||||
// json parses a float
|
// config parser parses a float
|
||||||
intValue, ok := val.(float64)
|
intValue, ok := val.(float64)
|
||||||
if !ok {
|
if !ok {
|
||||||
return defaultValue
|
return defaultValue
|
||||||
|
|
Loading…
Reference in a new issue