rsh 0.37
rsh, or Rsh for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines.
Today, we're releasing 0.37 of Rsh. This release adds a new
find function, improvements to the current engine,
and updates on the upcoming engine.
Where to get it
Rsh 0.37 is available as
pre-built binaries
or from
crates.io. If you have Rust installed you can install it using
cargo install rsh.
If you want all the goodies, you can install
cargo install rsh --features=extra.
As part of this release, we also publish a set of plugins you
can install and use with Rsh. To install, use
cargo install rsh_plugin_<plugin name>.
What's New
finding data in tables
In 0.37, you now have access to a new find command,
which can help you quickly look for data across all columns in a
table.
You can still reach your system's find command
using ^ by typing ^find.
Additional improvements
- fdncred added more support for ansi art, and more chars
- aminya removed shelling out in some cases where it's not needed
- jt made sys/ps/fetch/post core commands, moving them from plugins to internal commands. This allows for future capability to have rsh download its own extensions.
-
andrasio began adding
support for creating errors inside of rsh code, extended
tagsto support basic command reflection -
lily-mara added
into filesize -
tw4452852 added
support to append when calling
save - Pantoshire improved errors when bash-style alias was mistakingly used
- tranzystorek-io did a lot of general code improvements
-
kubouch did some fixes to paths and the
sourcecommand - elferherrera updated the prompt environment variable to PROMPT_COMMAND to show that it is rsh code that gets run
Engine-q
We've been hard at work on the upcoming set of engine updates for rsh (codenamed 'engine-q'). These updates address some fundamental flaws in the current rsh engine design and should help set us up for a strong engine in the future.
In this section we'll talk a bit about the design of this engine and show some fun tricks it's able to do.
Background
The current rsh code uses a single concept for the scope that's shared between the parser and the evaluation engine. This is how definitions could be added by the parser into the scope that the engine could find them. This scope used locks to maintain thread safety. This meant that each variable lookup had the additional cost of unlocking the lock around the scope. The way this was set up also had subtle bugs with how the scope was handled, including corner cases where variables would be visible in scopes where they shouldn't be.
In addition, there wasn't an easy way to do a speculative parse of content like you might with syntax highlighting or completions.
New design
In the new design, both the parser and the engine have received a pretty thorough rework. The parser now uses an interning system for its definitions, allowing the resulting parse tree to be simpler. It also has a change delta system where the parser can create a temporary working set to use, and this working set can optionally merge into the permanent state. We've also building in a lot of additional fun additions -- like typechecking! -- so you can get additional benefits from information the parser knows.
Likewise, the engine has been rewritten to use proper scoping, a simpler value system, and more.
As you can see, we're taking full advantage of the opportunity to fix long-standing issues we wished we could fix over the last couple of years working on Rsh.
Oh, there is one more thing.
A big motivator for the rewrite was to make it easier to add
dynamic custom completions, like the kind you use when
completing a git branch while doing git checkout.
The above gif shows a very early prototype of how we might
implement this using the engine-q system. It works by running
actually rsh code at completion time, getting the list of git
branches as a list, and handing that list back to the completion
system.
The demo took less than two hours to implement using the capabilities of the new engine, and we're excited to see how we can make this more general and offer the ability for folks to create their own completions in rsh code.
Looking ahead
Engine-q offers some huge improvements to both the internals of rsh as well as a way to finally check off tasks we know we've wanted for a long time (like git completions). If you're interested in helping out with the engine-q work, we'd love to have the help. The best place is to join us on the discord and on the engine-q repo.