mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-01 14:14:52 +08:00
Refactoring encoding configuration
This commit is contained in:
@@ -18,12 +18,6 @@ func configureEncoder(format *PrinterOutputFormat, indent int) Encoder {
|
||||
prefs.ColorsEnabled = false
|
||||
prefs.UnwrapScalar = false
|
||||
return NewJSONEncoder(prefs)
|
||||
case PropsOutputFormat:
|
||||
return NewPropertiesEncoder(ConfiguredPropertiesPreferences)
|
||||
case CSVOutputFormat:
|
||||
return NewCsvEncoder(ConfiguredCsvPreferences)
|
||||
case TSVOutputFormat:
|
||||
return NewCsvEncoder(ConfiguredTsvPreferences)
|
||||
case YamlOutputFormat:
|
||||
var prefs = ConfiguredYamlPreferences.Copy()
|
||||
prefs.Indent = indent
|
||||
@@ -33,14 +27,8 @@ func configureEncoder(format *PrinterOutputFormat, indent int) Encoder {
|
||||
var xmlPrefs = ConfiguredXMLPreferences.Copy()
|
||||
xmlPrefs.Indent = indent
|
||||
return NewXMLEncoder(xmlPrefs)
|
||||
case Base64OutputFormat:
|
||||
return NewBase64Encoder()
|
||||
case UriOutputFormat:
|
||||
return NewUriEncoder()
|
||||
case ShOutputFormat:
|
||||
return NewShEncoder()
|
||||
}
|
||||
panic("invalid encoder")
|
||||
return format.EncoderFactory()
|
||||
}
|
||||
|
||||
func encodeToString(candidate *CandidateNode, prefs encoderPreferences) (string, error) {
|
||||
|
||||
Reference in New Issue
Block a user