mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-07 02:48:27 +08:00
Refactoring JSON encoder prefs
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package yqlib
|
||||
|
||||
type JsonPreferences struct {
|
||||
Indent int
|
||||
ColorsEnabled bool
|
||||
UnwrapScalar bool
|
||||
}
|
||||
|
||||
func NewDefaultJsonPreferences() JsonPreferences {
|
||||
return JsonPreferences{
|
||||
Indent: 2,
|
||||
ColorsEnabled: true,
|
||||
UnwrapScalar: true,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *JsonPreferences) Copy() JsonPreferences {
|
||||
return JsonPreferences{
|
||||
Indent: p.Indent,
|
||||
ColorsEnabled: p.ColorsEnabled,
|
||||
UnwrapScalar: p.UnwrapScalar,
|
||||
}
|
||||
}
|
||||
|
||||
var ConfiguredJsonPreferences = NewDefaultJsonPreferences()
|
||||
Reference in New Issue
Block a user