heredoc handling
See original GitHub issueis there a reason that the contents of heredoc blocks are loaded as a single string instead of as json? If a single line is added at the bottom of the _end_heredoc() method like this:
t.value = json.loads(t.value)
the contents of the heredoc will be accessible as a dictionary like the rest of the document.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Bash HereDoc Tutorial With Examples | phoenixNAP KB
Learn how to use here documents (HereDocs) to parse multiline commands and enhance your terminal and Bash scripting knowledge.
Read more >Here Documents - The Linux Documentation Project
A here document is a special-purpose code block. It uses a form of I/O redirection to feed a command list to an interactive...
Read more >How to Use Heredoc in Shell Scripting - Tecmint
Here document (Heredoc) is an input or file stream literal that is treated as a special block ... which is passed to a...
Read more >How to use Here Document in bash programming - Linux Hint
A block of code or text which can be redirected to the command script or interactive program is called here document or HereDoc....
Read more >Bash Heredoc Tutorial For Beginners - OSTechNix
HereDoc, acronym for Here Document, is an input Redirection method to pass multiple inputs to a program or command in Bash.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, that could be done, but it would be a breaking change for anyone that has a heredoc that is JSON-like but they expect it to be loaded as a string. Everything I have found regarding heredocs seems to indicate that the contents should be treated as a string and not implicitly converted to something else.
I see. Unfortunately I don’t believe there is any requirement that heredocs must be in some JSON structure. For example, the official HCL repo has a test where the heredoc is not in a JSON structure: https://github.com/hashicorp/hcl/blob/master/test-fixtures/multiline.hcl
Therefore, this is something that would have to be done in post processing.