Refactoring Props encoder prefs

This commit is contained in:
Mike Farah
2024-02-24 15:14:21 +11:00
parent 2866e90c49
commit f44d47a204
6 changed files with 36 additions and 18 deletions
+10
View File
@@ -1,15 +1,25 @@
package yqlib
type PropertiesPreferences struct {
UnwrapScalar bool
KeyValueSeparator string
UseArrayBrackets bool
}
func NewDefaultPropertiesPreferences() PropertiesPreferences {
return PropertiesPreferences{
UnwrapScalar: true,
KeyValueSeparator: " = ",
UseArrayBrackets: false,
}
}
func (p *PropertiesPreferences) Copy() PropertiesPreferences {
return PropertiesPreferences{
UnwrapScalar: p.UnwrapScalar,
KeyValueSeparator: p.KeyValueSeparator,
UseArrayBrackets: p.UseArrayBrackets,
}
}
var ConfiguredPropertiesPreferences = NewDefaultPropertiesPreferences()