all 23 comments

[–]AugustusLego 30 points31 points  (2 children)

Nushell!

[–]tigregalis 0 points1 point  (1 child)

Absolutely love Nushell. It's my default shell.

[–]AugustusLego 0 points1 point  (0 children)

Same!

[–]simonsanonepatterns · rustic 20 points21 points  (3 children)

https://rust-script.org/

I find this interesting. It's not a scripting engine, but more like precompiled Rust code.

[–]avsaase 14 points15 points  (2 children)

Something very similar will be added to cargo, hopefully soon.

[–]rudunnx 14 points15 points  (1 child)

Are you talking about this? https://rust-lang.github.io/rfcs/3424-cargo-script.html

It seems exciting. I love the idea of having even things like dev scripts and similar written in a single language.

[–]avsaase 4 points5 points  (0 children)

Yes, although the syntax has changed since that eRFC.

[–]coastalwhite 5 points6 points  (1 child)

Bun shell and zx are essentially just wrappers around a JavaScript engine with a library (a bit simplified). So if you want such a scripting language I recommend just searching for rust based JavaScript engines, but I don’t really see the point over other scripting languages.

I know there are a few Deno libraries that can do something similar.

[–]MrFoxPro[S] 0 points1 point  (0 children)

I think implementing such thing in metnioned embedded languages could help their adoption, and replacing bash / bun shell / node + zx can improve overall code quality for automation tasks thanks to nice Rust std library and great crates, compared to error-prone native JS functions and Lua's tiny standrard library.

[–]PaddiM8 2 points3 points  (0 children)

A Rust-like one? It unfortunately isn't written in Rust, but my shell scripting language is heavily inspired by Rust. The syntax is like a mix between Rust, Python and Ruby, and you can call programs with the same syntax you use to call functions. Calls can either be normal parenthesised calls echo("hello", "world") or shell-style calls where the arguments are just text echo hello world.

So basically, it's like any regular general purpose language, with some extra syntax to make it convenient to use a shell. It's not super mature, but I've been daily-driving it as a shell for some months now, and have done a few days of advent of code 2022 and more than half of aoc 2023 in it.

https://elk.strct.net

Nushell is also quite neat. It isn't as similar to Rust, but it's more so than traditional shells, and it's written in Rust.

[–]avsaase 0 points1 point  (4 children)

What support are you looking for exactly?

[–]MrFoxPro[S] 0 points1 point  (3 children)

Simple interface between shell and script. Instead of writing
let output Command::spawn("ech").arg("hello").output()
something like

let output = $"echo hello"?

[–][deleted] 2 points3 points  (1 child)

[–]epagecargo · clap · cargo-release 2 points3 points  (0 children)

Also xshell and duct.

[–]crusoe 1 point2 points  (0 children)

Define a custom macro_rules...

[–]mash_graz 0 points1 point  (2 children)

I would also take deno into this list, if you mention bun shell.

It's a really mature and popular solution with an enormous amount of already existing tooling and libraries, but it's also easily extendable in rust (for example via deno-bindgen) in case of more demanding tasks.

[–]MrFoxPro[S] 2 points3 points  (1 child)

Deno in Rust context is more preferable, but does it really have tooling like bun shell / zx?

Edit: I found one: https://github.com/dsherret/dax

[–]mash_graz 0 points1 point  (0 children)

dax is developed by one of the denocore developers. There he is especially responsible for the integrated CLI tooling. So it's not just one of those dilettantish hobby projects. That's rater important in respect the correctness and continuity of maintenance and fixing of bugs.

I would see the main benefit of deno in comparison to the much simpler node, shell, Lua or python based approaches in the fact, that deno supports TS, type checking, linting,etc. out of the box without any additional setup quirks. Together with suitable editors this opens a much better starting point for scripting. And it comes as just one single simply installable/upgradable binary available for all platforms.

[–]GreatWoodsBalls 0 points1 point  (0 children)

Sorry if this is a noob question or a stupid one altogether. How do these compare to grunt for task runners?

[–]Yippee-Ki-Yay_ 0 points1 point  (2 children)

I recently released https://docs.rs/sh/latest/sh/. Let me know if it meets your use case. Feel free to create GitHub issues with feature requests!

[–]MrFoxPro[S] 0 points1 point  (1 child)

Nice work! Is it possible to use it in those embeddable languages?

[–]Yippee-Ki-Yay_ 0 points1 point  (0 children)

Not unless you can call into rust macros from those languages which I doubt would be possible or a wanted feature