Nushell 0.16.0

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.16 of Nu

Where to get it

Nu 0.16.0 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 more goodies, you can install cargo install nu --features=stable.

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

New automated release binaries (charlespierce, fdncred, sophiajt)

Up to this point, we've hand-rolled all the binary releases. The process has been time-consuming and error-prone. Starting with 0.16.0, we'll be releasing using the GitHub release automation. The first benefits you'll see is that we've also added a wix-based installer for Windows users. The second, perhaps harder to see, benefit is a more relaxed release process that's easier on the project maintainers 😃

Please note: as part of this, we took the opportunity to also align the directory structure across platforms. Apologies in advance for any inconvenience this might cause.

New textview (fdncred)

We've had a few requests for an improved text viewing experience, so with 0.16.0 we're trying out a new viewer based on the batopen in new window crate. We also support quite a lot of configuration settingsopen in new window for this new text viewer.

New commands

Let's get random (JosephTLyons)

We have a new top-level command: random. To start, there are three sub-commands:

  • random uuid - generate random UUIDs
  • random bool - a random "coin flip" with optional bias
  • random dice - roll a single or a set of dice, optionally setting the number of sides and number of dices

More math (JosephTLyons, arashout, andrasio, amousa11)

We've consolidated and added to our math operations. Now available as part of the 0.16.0 release:

  • math avg - averages a list of numbers
  • math sum - totals a list of numbers
  • math mode - gets the mode of a list of numbers
  • math median - gets the median of a list of numbers
  • math min - gets the minimum value of a list of numbers
  • math max - gets the maximum value of a list of numbers

Other commands

  • everyopen in new window - lets you skip every n-rows (kubouch)
  • ansi - lets you output ANSI color codes to color your strings (sophiajt, fdncred)
  • char - makes it possible to output newlines and tabs (sophiajt)
  • do - runs a block to completion, optionally ignoring errors (sophiajt)

Custom prompts (sophiajt)

You can now run a pipeline which returns a string, or list of strings, that is used to create a custom prompt. To do so, set the pipeline you want to use in the config for the prompt setting.

A simple example:

> config --set [prompt "echo '> '"]

We've also added a new ansi command to let you change the color. Let's use it to change the prompt to blue:

> config --set [prompt "echo $(ansi blue) '> '"]

You can make the prompt even fancier. For example, this prompt prints the current directory, git branch, and current date and time:

> config --set [prompt 'echo [ $(ansi green) $(pwd) $(ansi reset) $(do -i {git rev-parse --abbrev-ref HEAD } | trim | echo [ "(" $(ansi blue) $it $(ansi reset) ")" ] | str join) $(char newline) $(ansi cyan) $(date --format "%d/%m/%Y %H:%M:%S").formatted $(ansi reset) "> " ]']

image of full prompt

Example of full prompt

Or update your prompt to show an abbreviated path:

> config --set [prompt 'echo [ $(ansi green) $(pwd | split row "/" | first $(pwd | split row "/" | count | = $it - 1 ) | each { str substring "0,1" | format "{$it}/" } | append $(pwd | split row "/" | last ) | str join) $(do -i { git rev-parse --abbrev-ref HEAD | trim | echo $(ansi reset) "(" $(ansi blue) $it $(ansi reset) ")" | str join }) $(ansi reset) "> "]']

(note: the above assumes Unix-based systems, so on Windows use "" as the path separator))

image of abbreviated prompt

Example of abbreviated prompt

RFC process (jzaefferer)

We now have an RFC processopen in new window if you want to propose new features and breaking changes to Nu. Come let us know what you think and share your vision with us.

Starship becomes optional (fdncred)

We've made enabling starship a configuration option, rather than always being on. This allows you to opt-in, if you'd like the starship experience, but removes the requirement that you have to know to build without starship if you'd rather not have it (which may not be possible if you're using binary releases).

To enable starship, set the use_starship setting:

> config --set [use_starship $true]

New table drawing (sophiajt)

With 0.16.0, we now use a new table drawing algorithm. Here's the before and after for comparison:

image of a table before

Table drawn with 0.15.0

image of a table before

Table drawn with 0.16.0

If you're struggling to see much difference, that's a good thing! Where you'll really see the difference is in the time it takes to draw these tables:

image of a table before

0.16.0 renders tables 40% faster than 0.15.0

Simplified Chinese Nu book (zombie110year)

Over the past few weeks we've seen steady progress on the Simplified Chinese translation of the Nu book. With this release, another set of translated chapters were added.

Command improvements

  • to toml now properly disallows incorrect top-level values (arashout)
  • mkdir can now optionally show the names of directories created (utam0k)
  • uniq can now optional provide the counts of each value in the result (siedentop)
  • cal will now allow you to configure the start day of the week (JosephTLyons)
  • Division by zero is now an error that's caught and shown to the user (bailey-layzer)
  • date can now output formatted datetime strings (fdncred)
  • Docs added for autoview, touch, and pwd (orientnab)
  • New str join allows you to join a list of strings into a single string (sophiajt)
  • Wix build support (fdncred)
  • Fixes for running external commands using the new Windows links feature (fdncred)
  • open can now optionally take an encoding (fdncred)
  • The config settings file can now be readonly (sophiajt)

Internal improvements

  • Replaced use of async_stream macro with creating async streams directly (JosephTLyons, sophiajt)
  • Fixes to the ps process time algorithm (svartalf)
  • Interruptible stream API is now public (daschl)
  • We now test Windows drive changing during our CI tests (HiranmayaGundu)
  • Errors are now bubbled up earlier when possible (sophiajt)
  • Config loading no longer panics if it doesn't succeed (sophiajt)
  • Clean up and formatting of our docs (JosephTLyons)
  • Optimization work to not clone in some places (utam0k)

Looking ahead

We are looking into a few areas for the next release: further improving our per-directory environments, improving compile times, continuing to do code cleanup and pay down tech debt, and possibly more.