Live data from Hacker News

Show HN: Using Rust to write shell-script like tasks

github.com

81–83 of 83 posts

Re: Show HN: Using Rust to write shell-script like tasks

#81
post #78

Interesting, it seems that it allows the exact syntax of shell commands, without using strings. // valid rust code and shell code, no strings run_cmd!(du -ah . | sort -hr | head -n 10)?; How does rust parse the statement within run_cmd() ? Can rust parse other languages like this? run_html!( COOL )

Yes! If you are interested in doing front-end in Rust using Wasm, checkout Yew : https://github.com/yewstack/yew The data flow is inspired by React, you’ll feel right at home.

Re: Show HN: Using Rust to write shell-script like tasks

#83
post #59

Nothing can fix the fact, that pipes carry dumb byte streams. Powershell addressed this, but sadly remains unpopular in Unix crowd

Actually there are several shells out there that fix that problem and still support existing UNIX tools too (which Powershell doesn't play nice with). My own shell, https://github.com/lmorg/murex does this by passing type information along with the byte stream. So _murex_ aware tools can have structured data passed and POSIX tools can fall back to byte streams. Best of both worlds. The problem, however, is that as lo…

>The problem, however, is that as long as Bourne Shell and Bash are installed everywhere, people will write scripts for it.

This is also an issue of interpreted languages. Often I write bash and very constricted python2/3 compatible code, because I can be fairly sure the target audience has both of these.

You need to have everyone install (and maybe even use) your shell/language for them to be able to use it. Or have them recreate your environment (docker or cxfreeze). With Rust it's easy to distribute a small self contained binary.

Post reply on HN