Experimental changes, switched to toml instead of yaml. Hopefully everyone will like this as much as I do.
This commit is contained in:
15
uiterm/key_toml.go
Normal file
15
uiterm/key_toml.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package uiterm
|
||||
|
||||
// MarshalText implements the encoding.TextMarshaler interface for Key
|
||||
// This allows TOML to serialize Key values as strings
|
||||
func (i Key) MarshalText() ([]byte, error) {
|
||||
return []byte(i.String()), nil
|
||||
}
|
||||
|
||||
// UnmarshalText implements the encoding.TextUnmarshaler interface for Key
|
||||
// This allows TOML to deserialize strings back into Key values
|
||||
func (i *Key) UnmarshalText(data []byte) error {
|
||||
var err error
|
||||
*i, err = KeyString(string(data))
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user