mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
Handle scalars in property files
This commit is contained in:
parent
ac5346b138
commit
1b0a62d08d
@ -63,6 +63,11 @@ func (pe *propertiesEncoder) PrintLeadingContent(writer io.Writer, content strin
|
||||
}
|
||||
|
||||
func (pe *propertiesEncoder) Encode(writer io.Writer, node *yaml.Node) error {
|
||||
|
||||
if node.Kind == yaml.ScalarNode {
|
||||
return writeString(writer, node.Value+"\n")
|
||||
}
|
||||
|
||||
mapKeysToStrings(node)
|
||||
p := properties.NewProperties()
|
||||
err := pe.doEncode(p, node, "", nil)
|
||||
|
@ -162,6 +162,14 @@ var propertyScenarios = []formatScenario{
|
||||
expected: "mike: ${dontExpand} this\n",
|
||||
scenarioType: "decode",
|
||||
},
|
||||
{
|
||||
description: "print scalar",
|
||||
skipDoc: true,
|
||||
input: "mike = cat",
|
||||
expression: ".mike",
|
||||
expected: "cat\n",
|
||||
scenarioType: "roundtrip",
|
||||
},
|
||||
{
|
||||
description: "Roundtrip",
|
||||
input: expectedPropertiesUnwrapped,
|
||||
|
Loading…
Reference in New Issue
Block a user