-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alternative shell discussion #212
Comments
Honestly I really like nushell just because it lets me depend entirely on it, instead of using a bunch of programs and piping stuff through them, like, there is a |
I think it would be a good idea to write a test module in nushell and see how it goes. Maybe the flatpak installer because it currently needs to be rewritten to support multiple repos. As for how it's packaged, I think its best to maintain a container image. Would it be possible to create a Github action that builds a new image when Nushell creates a Github release? |
Yes, it would be possible to make a GitHub Action for that. We should do some test refactorings first, though, and discuss the 40MB. I don't know how much time it would add in the GitHub builders, if it was just a bind-mounted program like the configs are currently. I guess the module repository container image could include a folder for binaries required to run the modules? Maybe we could split to |
I also like how nushell centralizes a lot of currently used tools, to make things easier to maintain & troubleshoot in the future. As you also said, it has a lot of breaking changes, so bringing it into BlueBuild should be done when the language is stabilized & when it's more thoroughly + successfully used in other projects. I currently don't know how to write it, but I will definitely learn it in the future! |
Yeah, this is certainly not urgent, and we can wait until Nushell 1.0 to do more exploration. |
Just found out about https://elv.sh/, which also seems like a contender. Should compare that with nushell. Don't know if anything beats nushells data model, but elvish has a smaller binary. Elvish also has built-in paraller processing and json loading, and even markdown printing which nu doesn't have. It's also still pre-1.0, though. https://www.reddit.com/r/Nushell/comments/10fnbt7/how_nushell_differs_from_elvish/ |
I find Oils (formerly OilShell) interesting: I like how it is perfectly compatible with bash & POSIX scripts when using OSH shell mode. The difference in operation between OSH & bash is that OSH gives you clearer error & debug messages. YSH shell mode is a bit more radical Bash successor, without it being fully different, like some shell languages are. This one incorporates very nice improvements, like proper error log handling, which avoids occasional bad This is just 1 improvement, there are lots of it, which you can find in Oils docs. Those are just initial things that I discovered about it, there is more to learn. Developer's take on If you want to try it, Oils is available in |
We could totally support allowing |
I would just like to avoid installing too many binaries that the user wouldn't necessarily want. Currently that list is |
We probably don't need |
Looking at oil & ysh now, it seems to be more than a slightly better bash, which is how I dismissed it earlier. Particularly looking at the "shell idioms" page gives a pretty good picture of the language. In the reddit thread linked, this comment got me interested:
Looking at the nu docs, this doesn't seem to be true anymore, though. Ysh seems to be doing a lot of things right, but doesn't try to "rethink the shell". One thing that bums me out, though, is that the whole oil project is a jumble of python and c among others. Hopefully it is still faster than Xonsh, which I've heard is really slow. Ysh, Elvish, and Nushell are still all viable candidates in my mind. Ysh is the most basic of the bunch, while Elvish and Nushell both have a lot of interesting features, like built-ins for different types of data, and speed optimizations with JIT and catching errors before running the script. Nushell also has a testing framework, which seems to be unique to it. Something interesting Oil has is Hay, but there seems to be multiple other sublanguages and I'm not sure of their usability or integration with the shell language itself. I like a lot of the philosophy behind Ysh, but the documentation for the language itself is the most lacking compared to the others. The website outlines a lot of the process and thoughts behind it, but actual tutorials and reference pages regarding the language are lesser. I think a reasonable approach would be to just write the same module in each language, and trying to observe its benefits for the usecase. If there's not enough benefits to outweigh the "cost" of using an alternative shell, we can just keep using bash. |
I agree with this idea. Someday, I can try to rewrite However, I would like to do that when shell language becomes more stable, not now. |
Also, this was posted on the ublue discord: https://amber-lang.com/ Wouldn't need to ship an additional binary for the shell, but would still require using external programs for parsing data. I really like ECMAScript, but am unsure whether this language is mature enough for our needs. |
This is probably the coolest one I've seen TBH |
Looks interesting. I remember that there are some tries to simplify bash by having a lot of built-in functions, but this goes further by changing syntax too. I'll definitely follow its development. |
Ok, I tried Amber. Here are my findings:
It feels like Amber was made for webdevs afraid of bash needing to write a simple " Amber might be useful like NodeJS would be useful for writing scripts, with the additional feature of being able to run anywhere with Bash. |
I've also spent quite a bit of time using Nushell and would advocate for it's use as the way to write blue-build modules, over bash. |
Okay... I've been spending today on learning the basics of multiple alternative shells while writing a simple script in each one. I chose to build an oversimplified version of I tried to make the scripts as similar as possible to make syntax comparison easier, which worked well, as none of the shells I tried were radically different. (except Amber, which I dismissed in my earlier message, of course) The examples are structured such that before the The ElvishOverview:
Specific notes:
|
pt. 2, not serious contenders, but I still wrote the same script with them
|
Thoughts:
Next steps; maybe making a |
Do they not already supply an image with it? I was thinking of adding it like we do with |
Their repo has a Dockerfile with an alpine/musl version, couldn't find the image published anywhere. |
I really like the fact that our modules are mostly shell scripts, as that is the most straightforward way of automating customizations on any Linux system. Even solutions that are not shell-script native, such as Vib with it's Go-based modules, end up frequently just generating
RUN
statements forContainerfile
s.On the other hand,
bash
is just fine. Most Linux users know a bit ofbash
, but not many know enough to fluently read and write all quirky syntaxes, bugs, and features that end up being needed in larger projects like this.With that, I think it would be worth it to explore the prospects of using another (shell scripting) language for writing (at least some) of our modules.
There are many options for alternative shell scripting languages, but of them all, IMO the most promising is Nushell. It's typed, gives great errors, is very powerful and has very useful and readable helpers built in, and the syntax is clean and modern. Nushell supports reading many data types out of the box, including YAML and JSON, and manipulation of data is made elegant through pipelines.
I think it would be worth it to approach this topic through the following questions:
mikefarah/yq
, but it wouldn't be that hard for us to maintain one.Containerfile
s..tar.gz
release is almost 40MB, whileyq
binaries are only around 3 MB gzipped.RUN
statement, but that would still require the binary to be fetched each time the custom image is built.Prior art:
The text was updated successfully, but these errors were encountered: