mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 04:19:41 -08:00
parent
cdd4090c03
commit
83ac224e1f
|
@ -83,9 +83,15 @@ func (t *textTemplate) isStruct() bool {
|
||||||
func (t *textTemplate) structToMap() map[string]interface{} {
|
func (t *textTemplate) structToMap() map[string]interface{} {
|
||||||
context := make(map[string]interface{})
|
context := make(map[string]interface{})
|
||||||
v := reflect.ValueOf(t.Context)
|
v := reflect.ValueOf(t.Context)
|
||||||
|
if v.Kind() == reflect.Ptr {
|
||||||
|
v = v.Elem()
|
||||||
|
}
|
||||||
strct := v.Type()
|
strct := v.Type()
|
||||||
for i := 0; i < strct.NumField(); i++ {
|
for i := 0; i < strct.NumField(); i++ {
|
||||||
sf := strct.Field(i)
|
sf := strct.Field(i)
|
||||||
|
if !v.Field(i).CanInterface() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
name := sf.Name
|
name := sf.Name
|
||||||
value := v.Field(i).Interface()
|
value := v.Field(i).Interface()
|
||||||
context[name] = value
|
context[name] = value
|
||||||
|
|
Loading…
Reference in a new issue