Nushell 0.37

Nushell, or Nu 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 Nu. This release adds a new find function, improvements to the current engine, and updates on the upcoming engine.

Where to get it

Nu 0.37 is available as pre-built binariesopen in new window or from crates.ioopen in new window. If you have Rust installed you can install it using cargo install nu.

If you want all the goodies, you can install cargo install nu --features=extra.

As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use cargo install nu_plugin_<plugin name>.

What's New

finding data in tables

Screenshot showing using the new find command to find the phrase toml in a table

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

Engine-q

We've been hard at work on the upcoming set of engine updates for Nushell (codenamed 'engine-q'). These updates address some fundamental flaws in the current Nushell 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 Nushell 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 systemopen in new window 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 Nu.

Oh, there is one more thing.

Animated gif showing off dynaming git branch completions

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 nushell 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 nushell code.

Looking ahead

Engine-q offers some huge improvements to both the internals of Nushell 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.