Nushell 0.85

Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your command line. 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 command line pipelines.

Today, we're releasing version 0.85 of Nu. This release adds the first uutils command, unlocks more constant evaluation at parse time, and polishes many commands.

Where to get it

Nu 0.85 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.

NOTE: The optional dataframe functionality is available by cargo install nu --features=dataframe.

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 / New features

Nushell + Uutils = ❤️

📢The Nushell team is thrilled to announce 🥳 that we've begun working with the uutils/coreutils team on integrating some of their foundational core utilities into nushellopen in new window. With this release, we've started with the coreutils cp command, which we've temporarily named ucp. We're starting with ucp to allow broad testing while the current nushell cp command remains the default. We've already found one bugopen in new window in the coreutils cp command and you might find others. Once it stabelizes, probably with the 0.86.0 release, we'll remove the nushell cp command and rename ucp to cp. In keeping with the nushell style, we've only added a handful of parameters. We can, and probably will, add more if the community determines we need them. We're so very excited and would like to thank tertsopen in new window, from the coreutils team, for his excellent help and special appreciation to dmatos2012open in new window for the, very iterative, first uutils/coreutils integration PR #10097open in new window for the cp command. To read more about how this came to be, checkout our blog postopen in new window.

Quite a few bug fixes

Thanks to all the contributors below for helping us solve issues and bugs 🙏

authordescriptionurl
@rgwoodopen in new windowFix watch not detecting modifications on Windows#10109open in new window
@ito-hirokiopen in new windowFix tab completion order of directories to consistent with order of files#10102open in new window
@herobsopen in new windowFix 9156 endian consistency#9873open in new window
@ayax79open in new windowfixed usages of deprecated chrono DateTime::from_utc#10161open in new window
@zhiburtopen in new windowFix #10154#10162open in new window
@ofekopen in new windowFix example history command pipeline#10220open in new window
@dead10ckopen in new windowFix unit tests on Android#10224open in new window
@amtoineopen in new windowfix default after an empty where#10240open in new window
@IanManskeopen in new windowFix rm on macOS#10282open in new window
@horasalopen in new windowhandle empty pipeline while parsing let (fix Issue10083)#10116open in new window
@dmatos2012open in new windowFix variables not allowed in ucp#10304open in new window
@sholderbachopen in new windowUpdate crates-ci/typos and fix new typos#10313open in new window
@GomesGoncaloopen in new windowfix #10319: allow json request of value type list#10356open in new window
@sophiajtopen in new windowfix 'let' to properly redirect#10360open in new window
@amtoineopen in new windowfix the pretty printing of failing tests in std#10373open in new window
@J-Kappesopen in new windowfix input --until-bytes: now stops at any of given bytes#10235open in new window
@zhiburtopen in new windownu-table: Fix expand table unnecessary color in trail head config when wrap is used#10367open in new window
@fdncredopen in new windowfix some new chrono warnings#10384open in new window
@horasalopen in new windowprevent crash when use redirection with let/mut#10139open in new window
@horasalopen in new windowAllow operator in constants#10212open in new window
@zhiburtopen in new windownu-table: Patch restore lead trail space bg color#10351open in new window
@zhiburtopen in new windownu-table: Strip custom color in the header when used on border#10357open in new window

Consistent use of float for our floating point type

Breaking change

See a full overview of the breaking changes

Nushell currently supports two types to represent numbers without units: int for integer numbers and float for floating point numbers. The latter type was in important places incorrectly referred to as decimal. This hid the fact that as floating point numbers they have limited precision in some circumstances but higher performance compared to a decimal-encoded number.

With this release we fix this inaccuracy.

This means we introduce the commands into float and random float and deprecate the commands into decimal and random decimal. The old commands will be removed with the next release but continue to work for this release with a warning. Please use into float instead of into decimal and random float instead of random decimal.

After the type returned by describe has been float for a while, we now also change which type name is allowed when specifying command argument or input/output types.

# Argument with a specific type
def foo [bar: float] {}
# Command taking only floating point input from the pipeline and returning the same type.
def baz [] float->float {}

Previously both float and decimal were supported in those positions.

Some updates on explore

Breaking change

See a full overview of the breaking changes

The explore built-in commands have changed a bit during this release.

Now, it supports Vim bindings out of the box thanks to @amtoineopen in new window in #9966open in new window. @rgwoodopen in new window has simplified the available configuration entries which used to make the command less easy to understand in #10258open in new window#10259open in new window and #10270open in new window.

Thanks to him again, one can now quit the explorer by hitting any of ctrl+c, ctrl+d or ctrl+q (see #10257open in new window).

Improvements to parse-time evaluation

Conditional source and use is now possible.

The Nushell core team has been asked quite a lot of times to be able to do parse-time conditional sourceing or useing in the configuration, e.g. to load different things depending on the system:

if $nu.os-info.name == "windows" {
    source "my_windows_config.nu"
} else {
    source "my_unix_config.nu"
}

The above snippet does not work because Nushell's scoping rules keep the sourced values inside the block and the sourcing would not have any visible effect outside of the if/else statement (except environment changes).

While scoping still works the same, a series of PRs by @kubouchopen in new window made conditional source/use/overlay use possible:

What does this all mean? One can now write something very similar to the proposed snippet above! For example:

const WINDOWS_CONFIG = "my_windows_config.nu"
const UNIX_CONFIG = "my_unix_config.nu"

const ACTUAL_CONFIG = if $nu.os-info.name == "windows" {
    $WINDOWS_CONFIG
} else {
    $UNIX_CONFIG
}

source $ACTUAL_CONFIG

Looking for help!

#9499open in new window allows running selected commands at parse time. For example,

const f = ($nu.default-config-dir | path dirname)

is possible because path dirname was manually ported to allow parse time evaluation. Only a very limited subset of Nushell's commands is currently allowed to do so:

  • str length
  • path commands
  • Some core commands: describe, ignore, version, if

We would like to expand this set to allow more commands to run at parse time. If you'd like to help us porting more commands, we'd welcome your help! Please, see #10239open in new window for more information. Porting the commands is not difficult, but requires a bit of consideration, so it's better to reply to the issue or reach out to the core team beforehand.

Improving accessibility

Up until now, an issue for users using a screen reader was that Nushell errors and tables are quite fancy with some unicode characters. The issue is that screen reader might have trouble reading them, making the understanding of what's going on the REPL very hard...

For tables, it's quite easy, you can set $env.config.table.mode to something like "basic" or "none" and you should be good! But errors remained fancy

Error: nu::shell::external_command

  × External command failed
   ╭─[entry #4:1:1]
 1 foo
   · ─┬─
   ·  ╰── did you mean 'for'?
   ╰────
  help: No such file or directory (os error 2)

@JoaquinTrinanesopen in new window did implement screen reader-friendly errors in #10122open in new window which will hopefully make the experience a lot better when it comes to errors.

More support for more platforms

In this release, @dead10ckopen in new window made it possible to use Nushell in Termux (#10013open in new window) and fixed a bug on Android (#10225open in new window).

Improved history isolation

Breaking change

See a full overview of the breaking changes

Like many other shells, history between open sessions can be isolated in nushell. However, the former implementation had the disadvantage that it also blocked access to history of former sessions. It also didn't isolate hints. This is now fixed with !10402open in new window by @Hofer-Julianopen in new window. Since this was merged shortly before the release, this feature isn't the default yet. The file_format has to be changed to "sqlite" and isolation has to be set to true. You can find those in the config fileopen in new window under $nu.config-path. Please test this so we can fix problems before history isolation becomes the default.

Enhancing the documentation

Thanks to all the contributors below for helping us making the documentation of Nushell commands better 🙏

authordescriptionurl
@Hofer-JulianAdd notice to enable develop mode on Windows#10111open in new window
@fdncredupdate query web example because wikipedia changed their page#10173open in new window
@alsurenPoint from keybindings help to the book's reedline chapter#10193open in new window
@sholderbachDocument that open looks up from subcommands#10255open in new window
@baluptonreadme: add dorothy to supported by#10262open in new window
@brunerm99feat: Search terms for use, while, and range (#5093)#10265open in new window
@amtoineadd case-insensitive example to where#10299open in new window

Help with tests

Some more technical work but very helpful to make the source code of Nushell better, so thanks to our contributors who did improve the tests, often going through the whole source base and doing tideous find and replace 🙏

authordescriptionurl
@J-KappesTests: clean up unnecessary use of pipeline()#10170open in new window
@sholderbachRemove dead tests depending on inc#10179open in new window
@sholderbachSimplify rawstrings in tests#10180open in new window

Changes to commands

As usual, new release rhyms with changes to commands!

Some table themes

Want more delight? @fdncredopen in new window got you covered. He added a bunch of new table themes / modes in #10279open in new window.

echo is evolving

Coming from other shells, e.g. POSIX ones like Bash or Zsh, the distinction between Nushell's echo and print commands and the behaviour of echo itself could be confusing 🤔

  • print is a more programming-language-friendly command: it does print its arguments to the terminal directly, consuming them and thus not allowing to pipe the "output" of print further.
  • echo was only used to create values and pass them down a pipeline, e.g. echo "foo" | str length

@sophiajtopen in new window made the behaviour of echo a bit more general

  • it will print to the terminal if not redirected
  • it will pass the value down to the pipeline if redirected
echo "foo"  # will behave exactly as `print` does
echo "foo" | str length  # will compute the length of `"foo"` and forward the result without
                         # "printing" it unless it's the last command being run

Pythonesque operators removal

Breaking change

See a full overview of the breaking changes

Coming from Python, things like

3 * "foo"
[1, 2] * 10

would probably appear familiar.

However, they could lead to some strange internal behaviours and hard to debug issues 😕

> [3, "bob", 4] | reduce --fold 1 {|x, y| $x * $y}
bobbobbobbobbobbobbobbobbobbobbobbob

Note in the example above, we are mixing integer and string multiplication, which might get weird!

In this release, we decided to remove the string and list scalar multiplication in #10292open in new window and #10293open in new window from @sholderbachopen in new window.

However, we do not want to leave you without any other way to achieve the same, this is why @amtoineopen in new window did implement the repeat command in the standard library in #10339open in new window

  • bring it into your scope with use std repeat
  • you can do scalar string multiplication with something like "foo" | repeat 3 | str join
  • you can do scalar list multiplication with something like [1, 2] | repeat 3 | flatten

Optimizations

#10378open in new window Switched the default allocator to mimalloc as it's shown to reduce startup time by upwards of 30% on Windows. If it does not build on unique platforms nushell can be built without this feature, then using the platform's default allocator.

New commands

In the standard library we added the following commands:

Deprecations

Deprecated commands

Breaking changes

  • Plugin authors need to update plugins after the span refactor
  • Updated plugins need to be recompiled

Full changelog

Nushell

Extension

Documentation

Nu_Scripts

Reedline