Cicada: A Bash-like Unix shell written in Rust
github.comInteresting. Having the core terminal/language down is a good start. An important part of any terminal will be it's support for plugins/extensions or otherwise natively replacing them the way Fish tries to do.
I've recently started using https://elv.sh/ as my primary terminal after testing it out on/off for 2yrs and slowly porting old ZSH aliases/scripts into the Elvish language (very similar to Go which it runs on), coming from a decade on ZSH. There's a lot of opportunity in this space.
ZSH with the full suite of packages with autosuggestions and various other plugins (which I've grown fully dependent on) can get very slow on initial terminal loads, even with tracing and optimization.
Smaller tools like ripgrep and exa both written in rust help speed up common terminal commands: https://github.com/ogham/exa
The right term for what you refer to as terminal(s) is shell.
A terminal (or a terminal emulator) is not a shell and, moreover, a shell does not necessarily require a terminal.
Yeah of course... I use kitty as a terminal emulator with elvish as a default shell: https://github.com/kovidgoyal/kitty
Elvish is also a lightweight programming language like bash and zsh. Which is an underrated part of using shells (bash and zsh are quite awful even given the constraints of shell scripting and POSIX).
I've also recently started using elvish as my default shell full time and I really love it! Still needs some kinks worked out, but it's a very powerful shell. And pretty easy to pick up!
For anyone interested, here's a good article with some tips about working with/customizing elvish: https://zzamboni.org/post/my-elvish-configuration-with-comme...
can you share these zsh to elvish ports?
Yes, I intend to publish them soon when I’m more comfortable with it. I’ve only switched over this month and it’s changing often.
I released a vim plugin in the meantime: https://github.com/dmix/elvish.vim
And zzamboni on github has some good starting dot-files which I forked initially. https://github.com/zzamboni/dot-elvish
Otherwise I’m interested in creating an oh-my-elvish type library in the future.
Yes, please...and also your experience with elvish in general?
Discussed in 2017: https://news.ycombinator.com/item?id=14675431
Yeah, I submited once on HN about this project two years ago. Since then quite a few new features have been added and some improvements are made. So it's time to expand the user base a bit :)
Now cicada shell is still have some issues, but overall it's quite usable. I hope it could be useful for people who are seeking simplicity and speed in daily use of the shell.
It's fine to repost after that much time has gone by. This is in the FAQ: https://news.ycombinator.com/newsfaq.html.
But the link back to the earlier post is also nice to have, thanks.
cicada> echo -e '#!/bin/sh\necho works' > /bin/1
cicada> chmod +x /bin/1
cicada> 1
1
bash> 1
works
cicada> touch a b; echo "$(echo "$(echo "$(ls)")")"
$(echo $(echo a
b
bash> echo "$(echo "$(echo "$(ls)")")"
a
bFor `touch a b; echo "$(echo "$(echo "$(ls)")")"`, I'll think about it.
It looks like a bad command to me (nested $ and nested `"` do not smell good). Probably I would mark this a wont-fix. But if I found I does make sense (useful in some meaningful places) - I'll consider to update cicada to align with Bash. Thanks for reporting.
Nested $() is fine, and not uncommon (though 3 levels like here is rarely used). All the nested "" present here are required, as removing any of them would cause a change in behavior (caused by word splitting).
# you have to use full path to make it work:
cicada> /bin/1
A bare `1` is a math arithmetic, as described in README, which with a higher precedence.
Perhaps you should consider removing the statement "Cicada will only be a "subset" of bash" from the project FAQ.
> Math arithmetic directly in the shell![1]
Killer feature right there.
[1]: https://github.com/mitnk/cicada#math-arithmetic-directly-in-...
I was looking for something actually bringing a net positive... but the FAQ has answered my question
> Why another shell?
> Because we can. :)
It doesn't do anything exciting that I can tell.
This post would be more useful if it were titled as a 'learn how to write a shell in Rust'.
Those who do not understand Unix are condemned to reinvent it, poorly. -- Henry Spencer
Yay! Non-portable Unix tools! Just what everyone wants.
> Those who do not understand Unix are condemned to reinvent it, poorly. -- Henry Spencer
I absolutely abhor this quote, I think it's taken out of context.
First of all, it denotes hubris, which I hate.
Secondly, it's totally anti-scientific, it assumes that Unix is some paragon of OS design, the zenith of Computer Science.
I like Unix as much as the next IT guy, but let's cut it out with the cliché quotes. There's plenty of things Unix doesn't do that well (everything is a file, until it isn't; filenames are basically binary blobs, etc.: https://dwheeler.com/essays/fixing-unix-linux-filenames.html).
Plus your comment is just silly, whoever implemented this obviously knew about Unix shells... It takes knowledge of Unix shells to implement another Unix-y shell.
This isn't reinventing Unix, this is a (cut down part of) Unix. (Unix the family, not the original Bell Labs OS, of course).
And "non-portable" because it's only portable to Unix? That's... Approximately everything. Linux family and Darwin naively, NT via WSL/cygwin/etc., BSDs obviously, Android sorta-natively or via Termux, Chrome OS via Termux, crouton, or crostani(sp?). What is Unix not portable to?
It's probably the usual complaint of Rust not being able to run on an obscure 1965-era calculator.
I can't run C on a 8-bit calculator either. At least not using GCC or Clang or any other mainstream compiler. Sure, I could use some toy compiler for that, but then 99% of the libraries I'd like to use won't work there anyways, due to a variety of issues.
I was about to object, but actually it looks like you're right; tigcc appears to only target the TI-89 et al. which run on the 16-bit Motorola 68000 series. A quick search doesn't give me any C compiler for the TI-84 after all.
Your actual point, of course, is valid regardless:)
EDIT: Oops, actually https://en.wikipedia.org/wiki/Small_Device_C_Compiler ... but then you're right about getting pretty obscure.
Except, UNIX wasn't the first OS with a shell. There was at least 10 years of shell history before UNIX came to be.
What's not portable about it? Rust is reasonably portable, no?
Also they are claiming to be generally (but not strictly) POSIX-compatible.