mirror of
https://github.com/taigrr/yq
synced 2025-01-18 04:53:17 -08:00
Can now update tag/style of nodes without affecting the value
This commit is contained in:
@@ -13,10 +13,11 @@ import (
|
||||
var log = logging.MustGetLogger("yq")
|
||||
|
||||
type UpdateCommand struct {
|
||||
Command string
|
||||
Path string
|
||||
Value *yaml.Node
|
||||
Overwrite bool
|
||||
Command string
|
||||
Path string
|
||||
Value *yaml.Node
|
||||
Overwrite bool
|
||||
DontUpdateNodeValue bool
|
||||
}
|
||||
|
||||
func KindString(kind yaml.Kind) string {
|
||||
|
||||
@@ -21,7 +21,9 @@ func UpdateNavigationStrategy(updateCommand UpdateCommand, autoCreate bool) Navi
|
||||
DebugNode(node)
|
||||
log.Debug("with")
|
||||
DebugNode(changesToApply)
|
||||
node.Value = changesToApply.Value
|
||||
if !updateCommand.DontUpdateNodeValue {
|
||||
node.Value = changesToApply.Value
|
||||
}
|
||||
node.Tag = changesToApply.Tag
|
||||
node.Kind = changesToApply.Kind
|
||||
node.Style = changesToApply.Style
|
||||
|
||||
Reference in New Issue
Block a user