1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:27:42 +00:00
serenity/Userland
Ali Mohammad Pur 3048274f5e Shell: Add support for heredocs
Closes #4283.
Heredocs are implemented in a way that makes them feel more like a
string (and not a weird redirection, a la bash).
There are two tunables, whether the string is dedented (`<<-` vs `<<~`)
and whether it allows interpolation (quoted key vs not).
To the familiar people, this is how Ruby handles them, and I feel is the
most elegant heredoc syntax.
Unlike the oddjob that is bash, heredocs are treated exactly as normal
strings, and can be used _anywhere_ where a string can be used.
They are *required* to appear in the same order as used after a newline
is seen when parsing the sequence that the heredoc is used in.
For instance:
```sh
echo <<-doc1 <<-doc2 | blah blah
contents for doc1
doc1
contents for doc2
doc2
```
The typical nice errors are also implemented :^)
2021-04-29 20:25:56 +02:00
..
Applets AK: Rename adopt() to adopt_ref() 2021-04-23 16:46:57 +02:00
Applications Tests: Enable Spreadsheet unit tests so they actually build 2021-04-29 10:37:26 +02:00
Demos Userland: Fix two misaligned copyright headers 2021-04-29 00:59:26 +02:00
DevTools Everywhere: Use "the SerenityOS developers." in copyright headers 2021-04-29 00:59:26 +02:00
DynamicLoader Tests: Unify LibC tests to single location. 2021-04-29 10:37:26 +02:00
Games Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Libraries LibCore: Support Vector<String> positional arguments 2021-04-29 11:10:06 +02:00
Services Everywhere: Use "the SerenityOS developers." in copyright headers 2021-04-29 00:59:26 +02:00
Shell Shell: Add support for heredocs 2021-04-29 20:25:56 +02:00
Tests Tests: Convert LibC exec unit test to be LibTest based. 2021-04-29 10:37:26 +02:00
Utilities Utilities: Use Vector<String> positional arguments in some places 2021-04-29 11:28:01 +02:00
CMakeLists.txt Userland: Rename *.MenuApplet => *.Applet 2021-04-04 16:29:55 +02:00