4 ms·
Compare to Deno, which also makes JS friendlier for shell scripting! https://deno.land/ https://deno.land/ Coming from Deno, the single biggest advantage I see
by szhu 5y ago
Compare to Deno, which also makes JS friendlier for shell scripting! https://deno.land/ https://deno.land/
Coming from Deno, the single biggest advantage I see here is the handy tag function $:
await $`cat package.json | grep name`
Hoping someone will write a Deno port of this.
- Raed667 5y agoIt would be an interesting CS problem to properly type the return values of random bash commands.
- orta 5y agoThis was kinda explored at the start of April this year: https://github.com/microsoft/TypeScript/pull/43480 https://github.com/microsoft/TypeScript/pull/43480
- maga 5y agoThat's rather trivial with Deno.run, here I just wrote a gist for that out of curiosity: https://gist.github.com/zandaqo/93004fb265146a95aadb28ec851a1d72 https://gist.github.com/zandaqo/93004fb265146a95aadb28ec851a...
- japanuspus 5y agoThank you for posting -- I had never heard of tagged template literals! Reading the docs [1], it appears there is a `raw` property which might make this even simpler? [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#raw_strings https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- maga 5y ago`raw` would allow us to pass the input as is without escaping it using JS rules, but otherwise the code would remain the same, we still have to "stitch" both arrays together with the loops.