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
+2 -1
View File
@@ -184,12 +184,13 @@ func configureEncoder() (yqlib.Encoder, error) {
func createEncoder(format *yqlib.PrinterOutputFormat) (yqlib.Encoder, error) {
yqlib.ConfiguredXMLPreferences.Indent = indent
yqlib.ConfiguredPropertiesPreferences.UnwrapScalar = unwrapScalar
switch format {
case yqlib.JSONOutputFormat:
return yqlib.NewJSONEncoder(indent, colorsEnabled, unwrapScalar), nil
case yqlib.PropsOutputFormat:
return yqlib.NewPropertiesEncoder(unwrapScalar, yqlib.ConfiguredPropertiesPreferences), nil
return yqlib.NewPropertiesEncoder(yqlib.ConfiguredPropertiesPreferences), nil
case yqlib.CSVOutputFormat:
return yqlib.NewCsvEncoder(yqlib.ConfiguredCsvPreferences), nil
case yqlib.TSVOutputFormat: