New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Appending to an existing array with double quoted style not working #722
Comments
I'm not at a pc with
|
@mikefarah I was hoping below would work too, but it is leaving yq e '.spec.template.spec.containers[0].command += "d"' yaml Any chance to optimize this to a shorter form? yq e '.spec.template.spec.containers[0].command |= ["a", "b", "c","d"]| .spec.template.spec.containers[0].command.[] style="double"' |
Ah yep I see it now - the newly appended element has no styling and so it defaults to idiomatic yaml styling - that is no quotes. I guess the best thing for |
Ooh I did just think of a shorter form using variables you could use in the interim:
It looks like you're just adding 'd' so you could also:
|
Fixed in 4.19.1. |
When trying to update/append to an array of existing strings, keeping
"double"
style also modifies other elements. As seen on yq version 4.5.1 (Linux)Objective is to modify the
command
toTried below which works, but also applies the style attribute to
containerPort
, converting it to a string.yq e '.spec.template.spec.containers[0].command |= ["a", "b", "c","d"]|..style="double"' yaml
The text was updated successfully, but these errors were encountered: