-
-
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
Newline are not preserved when using >
for strings (for both read and write operations)
#563
Comments
Any news about it ? |
Hi - sorry I must have missed this! This is an issue with the underlying go-yaml parser - which I don't have control of unfortunately. I beleive there are issues raised against it already. The good news is that it is a cosmetic issue, the |
Hi ! The problem is that I got to differentiate a regular space and an actual line break so that I can directly put a whole formatted file as multiline string variable |
In that case you will need to use a different string block indicator, have a look at that yaml multiline site, I think you need to use '|'
…________________________________
From: Mike AUBENAS ***@***.***>
Sent: Monday, October 4, 2021 11:19:01 AM
To: mikefarah/yq ***@***.***>
Cc: Mike Farah ***@***.***>; Comment ***@***.***>
Subject: Re: [mikefarah/yq] Newline are not preserved when using `>` for strings (for both read and write operations) (#563)
Hi !
The problem is that I got to differentiate a regular space and an actual line break so that I can directly put a whole formatted file as multiline string variable
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#563 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAIZHNI57B5TJFYLBBTJL5TUFDXHLANCNFSM4SPLB2OA>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Describe the bug
When a string using
>
is present in the YAML, the string will be inlined following a read or write.version of yq: 3.4.0
operating system: Ubuntu 18.04.4 LTS
Input YAML:
test.yml:
Output YAML:
Command
The command you ran:
Actual behavior
As seen in the previous snippet, it seems as though the strings are joined on newlines.
Expected behavior
The string should be kept as is. The current output does not seem to be equivalent with the input one.
Additional context
The same behaviour is also true with the
write
command. If there is a string using>
inside the YAML document and thewrite
command is used, it will inlined as in theread
command.The text was updated successfully, but these errors were encountered: