Nushell 0.63

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 version 0.63 of Nu. This release is the first to include the 'overlays' feature, hooks, lazy dataframes, and more.

Where to get it

Nu 0.63 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 built-in goodies, you can install cargo install nu --features=extra.

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

Themes of this release

Overlays (kubouch)

We've added a new concept into this release that merges a few of our previous design ideas together: overlays. You can think of overlays like layers in a paint program. They work together to give you a set of commands, environment variables, and more that you can turn on and off as needed.

For example, we can create an overlay to work in:

(zero) > module code { export env BAZ { "baz" } }
(zero) > overlay add code
(code) > $env.BAZ
baz
(code) > let-env BAGR = "bagr"
(code) > $env.BAGR
bagr
(code) > overlay remove code
(zero) > # environment back to what we started with

Just like layers in a paint program, changes you make (like the update to the environment above) are part of the layer. You can use --keep-custom to keep the changes you have made even after you hide the overlay. Using add and remove are effectively like show and hide, allowing you to quickly switch into a new context, do some work, and switch out with little effort.

Hooks (jt)

Starting with 0.63, you can now set up hooks that will run code under certain conditions. These hooks run after your code has finished evaluating.

Let's look first at how to set up the hooks, and then see what the hooks output. To set up a hook, you pick the kind of hook and then configure a block of code to run when that hook fires:

hooks: {
    pre_prompt: [{
        print "pre_prompt hook"
    }]
    pre_execution: [{
        print "pre_execution hook"
    }]
    env_change: {
        PWD: [{|before, after|
            print $"PWD environment variable changed from ($before) to ($after)"
        }]
    }
}

Using this example, we can watch the hooks fire:

/home/jt/Source/nushell〉cd ..
pre_execution hook
pre_prompt hook
PWD environment variable changed from /home/jt/Source/nushell to /home/jt/Source
/home/jt/Source〉

Used together with the "overlays" feature above, we hope to open up the possibility for a lot of powerful interactions with the shell while still keeping the workflow that makes Nushell special.

Lazy dataframe support (elferherrera)

We are starting to support a new way to query dataframes by using lazyframes. This new concept will allow users to build logical plans for the data operations which will result in a reduction of the dataframe processing time.

Lazy dataframes are accessed through the same dfr command and give you a way to build up a pipeline to execute in a more optimal way than the previous eager dataframes. For example, you can perform your aggregations and group-bys lazily, and then work on the results instead of paying for the processing time of having two separate steps.

New commands

  • (Returned from the engine rewrite) histogram for checking distributions right inside nushell (WindSoilder)
  • config nu and config env to easily edit your nushell configuration files with your editor of choice (Kangaxx-0/vFrankZhang)
  • str title-case (krober)
    > 'this is a test case' | str title-case
    This Is A Test Case
    
  • Many new db subcommands (elferherrera)

Quality-of-life Improvements

  • More commands contain additional search terms to find them if you don't remember their exact name. (victormanueltn, LawlietLi) This is a great way to help out by contributing! More information can be found hereopen in new window.

  • print -n option to print output without an additional new-line (fdncred)

  • flatten now has a more consistent behavior for nested records and tables. (WindSoilder) This now more closely matches the pre-0.60 flatten, and should help create more predictable output.

  • We now support octal binary literals 0o[777] similar to the hexadecimal 0x[FF] and binary 0b[11111111] literals (toffaletti)

  • cd accepts abreviation of paths to quickly jump to nested directories based on unique prefixes (fdncred)

    > $env.PWD
    ~/some/path
    > cd d/s/9
    > $env.PWD
    ~/some/path/deep/space/9
    
  • Various improvements make the completions feel more polished (herlon214, PurityLake)

  • If $config.buffer_editor is not set rely on the $env.EDITOR and $env.VISUAL environment variables to find a text editor to edit longer pipelines or your config ... (Kangaxx-0/vFrankZhang, sholderbach)

  • When invoking nu to run a script you can now pass the --config flag to load your config.nu and have the definitions available when running the script (WindSoilder)

  • Similarly you can change the table appearance with the --table-mode flag when invoking nu (fdncred)

Note: this is a shortened list. For the full list, see the "Changelog" section below

Breaking changes

Changed default keybindings:

Old bindingNew bindingActionReason for the change
Ctrl-xCtrl-rVisual history search menuWe replaced the simple history search (previously bound to Ctrl-r, cmd: SearchHistory) with the menu that supports previewing several entries at once for quick navigation
Ctrl-qF1Interactive help menuF1 is generally the convention for help information, with this menu you can search for commands browse through their documentation and pick examples to include/run

Looking ahead

Here are a few of the things we're working on:

SQLite based history. This will maintain a larger number of entries that can searched using date, usage or text.

Input/output types. These will allow commands to be specialized based on the input they're given as we well as allow the typechecker to check that commands can connect on the pipeline together.

And more - we're still looking ahead to IDE support, better database support, and more.

Changelog

Nushell

Documentation

Nu_Scripts

reedline