-
-
Notifications
You must be signed in to change notification settings - Fork 629
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
Trailing space in string block transforms to quoted form #1277
Comments
I appreciate the script is commercial - they often are. There has been no changes that I'm aware of that should produce that effect. CONTENTS="cat
dog" ./yq -n '.x = strenv(CONTENTS)' and it resulted: x: |-
cat
dog Unless you give me a representative (non-commercial :) ) example that I can reproduce the problem with - there's little I can do to help. I've got this guide here that may help as well: https://mikefarah.gitbook.io/yq/operators/string-operators#string-blocks-bash-and-newlines |
Hi Mike, I figured it out! One of lines in my bash script had a trailing space. With your example is like putting a space right after cat or dog. To be honest even if it's a correct behavior it's completely unexpected. And there were no warnings or anything giving a clue the spaces are forbidden with this style. |
Ooh I haven't seen that before - that is odd. A trailing space in a block changes to a quoted string - this even happens when opening a file in that format. |
FYI this depends on a fix for go-yaml/yaml#880 |
This issue also occurs with CRLF line endings.
outputs
|
FYI - you can use
|
Duplicate of #566 |
Describe the bug
I use next expression to update YAML item
Where
CONTENTS
keeps some long bash script.It worked well for me until some recent changes the the bash script.
So if before something went wrong IIRC the content in YAML looked like
Then now it looks like
basically making it unreadable in the YAML
Version of yq: 4.26.1
Operating system: linux
Installed via: binary release
Input Yaml
Unfortunately the YAML source and the scrips I use are commercial, so I can't post them here and I haven't tried to find the relevant change myself in hope it's something known.
So basically I want the behavior I had initially.
The text was updated successfully, but these errors were encountered: