You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I often have bash scripts with lots of heredocs. It's very convenient to consolidate many scripts and code snippets into one bash script. However, the lack of formatting within the heredocs makes it harder to spot mistakes if editing for example, a bash script within a heredoc.
What is the feature you are proposing to solve the problem?
Having code formatting in the individual heredoc sections, provided a shebang exists to indicate the language.
#!/bin/bashecho"code is formatted here"
cat > /my/path << 'EOF'#!/bin/bashecho "code is also formatted here"var="oops forgot a closing double quotes, help!EOF
cat > /my/path2 <<EOF#!/bin/pythonprint("it would be cool if this could be formatted too in whatever language the shebang corresponds to")EOF
cat > /my/path3 <<EOFThis is not formattedEOF
The only way formatting should work is if a shebang was provided, otherwise the heredoc could be for any purpose.
It would be really cool if this worked for any language in the heredoc's shebang, but I could imagine that being trickier. This feels similar to what markdown formatting is like:
# This is markdown```bashecho"bash code formatted in markdown codeblock. similar idea to a heredoc"``````pythonprint('python formatting in this code block in markdown)```
What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered:
What is the problem this feature will solve?
I often have bash scripts with lots of heredocs. It's very convenient to consolidate many scripts and code snippets into one bash script. However, the lack of formatting within the heredocs makes it harder to spot mistakes if editing for example, a bash script within a heredoc.
What is the feature you are proposing to solve the problem?
Having code formatting in the individual heredoc sections, provided a shebang exists to indicate the language.
The only way formatting should work is if a shebang was provided, otherwise the heredoc could be for any purpose.
It would be really cool if this worked for any language in the heredoc's shebang, but I could imagine that being trickier. This feels similar to what markdown formatting is like:
What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered: