File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 "io/ioutil"
88 "reflect"
99 "strconv"
10+ "strings"
1011
1112 "github.com/BurntSushi/toml"
1213 colorful "github.com/lucasb-eyer/go-colorful"
@@ -136,6 +137,28 @@ func ConfigValue(v interface{}, dst interface{}) error {
136137 return fmt .Errorf ("unhandled type %+v for color.Color conversion" , reflect .TypeOf (vt ))
137138 }
138139
140+ case * []string :
141+ switch vt := v .(type ) {
142+ case string :
143+ * d = strings .Split (vt , ";" )
144+ default :
145+ return fmt .Errorf ("unhandled type %+v for []string conversion" , reflect .TypeOf (vt ))
146+ }
147+
148+ case * []color.Color :
149+ switch vt := v .(type ) {
150+ case string :
151+ cls := strings .Split (vt , ";" )
152+ var clrs []color.Color
153+ for _ , cl := range cls {
154+ clr , _ := colorful .Hex (cl )
155+ clrs = append (clrs , clr )
156+ }
157+ * d = clrs
158+ default :
159+ return fmt .Errorf ("unhandled type %+v for []color.Color conversion" , reflect .TypeOf (vt ))
160+ }
161+
139162 default :
140163 return fmt .Errorf ("unhandled dst type %+v" , reflect .TypeOf (dst ))
141164 }
You can’t perform that action at this time.
0 commit comments