mirror of
https://github.com/taigrr/yq
synced 2025-01-18 04:53:17 -08:00
Merge master fix
This commit is contained in:
parent
3355e80d85
commit
a8cfccd3af
@ -512,7 +512,7 @@ func readUpdateCommands(args []string, expectedArgs int, badArgsMessage string,
|
|||||||
log.Debug("path %v", args[expectedArgs-2])
|
log.Debug("path %v", args[expectedArgs-2])
|
||||||
log.Debug("Value %v", args[expectedArgs-1])
|
log.Debug("Value %v", args[expectedArgs-1])
|
||||||
value := valueParser.Parse(args[expectedArgs-1], customTag, customStyle, anchorName, makeAlias)
|
value := valueParser.Parse(args[expectedArgs-1], customTag, customStyle, anchorName, makeAlias)
|
||||||
updateCommands[0] = yqlib.UpdateCommand{Command: "update", Path: args[expectedArgs-2], Value: value, Overwrite: true, DontUpdateComments: true}
|
updateCommands[0] = yqlib.UpdateCommand{Command: "update", Path: args[expectedArgs-2], Value: value, Overwrite: true, CommentsMergeStrategy: yqlib.IgnoreCommentsMergeStrategy}
|
||||||
} else if len(args) == expectedArgs-1 && allowNoValue {
|
} else if len(args) == expectedArgs-1 && allowNoValue {
|
||||||
// don't update the value
|
// don't update the value
|
||||||
updateCommands = make([]yqlib.UpdateCommand, 1)
|
updateCommands = make([]yqlib.UpdateCommand, 1)
|
||||||
|
@ -62,7 +62,7 @@ func mapKeysToStrings(node *yaml.Node) {
|
|||||||
|
|
||||||
if node.Kind == yaml.MappingNode {
|
if node.Kind == yaml.MappingNode {
|
||||||
for index, child := range node.Content {
|
for index, child := range node.Content {
|
||||||
if index % 2 == 0 { // its a map key
|
if index%2 == 0 { // its a map key
|
||||||
child.Tag = "!!str"
|
child.Tag = "!!str"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ func UpdateNavigationStrategy(updateCommand UpdateCommand, autoCreate bool) Navi
|
|||||||
}
|
}
|
||||||
node.Anchor = changesToApply.Anchor
|
node.Anchor = changesToApply.Anchor
|
||||||
node.Alias = changesToApply.Alias
|
node.Alias = changesToApply.Alias
|
||||||
if !updateCommand.DontUpdateComments {
|
if updateCommand.CommentsMergeStrategy != IgnoreCommentsMergeStrategy {
|
||||||
node.HeadComment = changesToApply.HeadComment
|
node.HeadComment = changesToApply.HeadComment
|
||||||
node.LineComment = changesToApply.LineComment
|
node.LineComment = changesToApply.LineComment
|
||||||
node.FootComment = changesToApply.FootComment
|
node.FootComment = changesToApply.FootComment
|
||||||
|
Loading…
x
Reference in New Issue
Block a user