# 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
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
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
# Additional improvements
- fdncred added more support for ansi art (opens new window), and more chars (opens new window)
- aminya removed shelling out in some cases where it's not needed (opens new window)
- jt made sys/ps/fetch/post core commands (opens new window), moving them from plugins to internal commands. This allows for future capability to have nushell download its own extensions.
- andrasio began adding support for creating errors inside of nushell code (opens new window), extended
tagsto support basic command reflection (opens new window)
- lily-mara added
into filesize(opens new window)
- tw4452852 added support to append when calling
save(opens new window)
- Pantoshire improved errors when bash-style alias was mistakingly used (opens new window)
- tranzystorek-io did a lot of general code improvements (opens new window)
- kubouch did some fixes to paths and the
sourcecommand (opens new window)
- elferherrera updated the prompt environment variable to PROMPT_COMMAND (opens new window) to show that it is nushell code that gets run
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.
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 system (opens 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.
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.