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 was trying to write a command over multiple lines. My first instinct was to use \ at the end of each line as in sh, but it doesn't seem like that's necessary so I guess it just collapses the extra whitespace/newlines. I noticed that I can write a command over multiple lines as long as there is no newline before the command in the template string. If there is, it throws an error.
$ cat a.ts
import { $ } from 'jsr:@david/dax';
await $`echo
one
two
`;
$ cat b.ts
import { $ } from 'jsr:@david/dax';
await $`
echo
one
two
`;
$ deno run -A a.ts
one two
$ deno run -A b.ts
error: Uncaught (in promise) "Unexpected character.\n \n echo\n one\n two\n\n ~"
It seems like allowing for the latter style (b.ts) should be as simple as trimming any whitespace from the start of the string? For now I'm just using the former method, but I'd like to be able to use the latter as I find it a little more readable.
The text was updated successfully, but these errors were encountered:
I was trying to write a command over multiple lines. My first instinct was to use
\
at the end of each line as in sh, but it doesn't seem like that's necessary so I guess it just collapses the extra whitespace/newlines. I noticed that I can write a command over multiple lines as long as there is no newline before the command in the template string. If there is, it throws an error.It seems like allowing for the latter style (b.ts) should be as simple as trimming any whitespace from the start of the string? For now I'm just using the former method, but I'd like to be able to use the latter as I find it a little more readable.
The text was updated successfully, but these errors were encountered: