Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub

Nushell 0.78

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.78 of Nu. This release adds pattern matching, speed improvements, easier cell paths when columns may be missing, better error handling, and much more.

Where to get it

Nu 0.78 is available as pre-built binaries or from crates.io. 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

Pattern matching (sophiajt)

With 0.78, Nushell now comes with the match expression, which allows you to do pattern matching on a value. It supports a variety of different kinds of patterns, which can be mixed and matched to create more complicated patterns.

A simple example matching against a constant or a range:

match 3 {
  1 => { print "it's a 1" }
  1..10 => { print "it's between 1 and 10" }
}

Another example, this time matching against a record value, with a fall-through if it doesn't match:

match $a {
  {x: $x, y: 10} => { print $"y is: 10 and x is: ($x)" }
  _ => { print "the above didn't match, so we print this instead" }
}

You can also match on the elements of a list:

match $list {
  [$one] => { print "one element list" }
  [$one, $two] => { print "two element list" }
  [$head, ..$tail] => { print $"the tail of the list is ($tail)" }
}

Alias changes (kubouch)

Aliases now can shadow

We've updated the new alias command we introduced in 0.77 to work more closely to the previous one. For example:

> alias l = ls -a
> alias l = ls -l

Will now create the l alias that points to ls -l, with most recent line getting precedence during alias expansion.

Alias can be named the same as the aliased command

> alias ls = ls -a

Now correctly displays all files when calling ls, instead of throwing an unhelpful error.

Old alias still keeps working

Since there are still some remaining issues to fix with the new alias implementation, we still keep old-alias around for this release.

Speed improvements (sophiajt)

We've sped up the performance of tight loops like for and while considerably in this release. For example, on our test machine:

Example 1: timeit { for x in 1..1000000 {} }

  • 0.77.1: 908ms
  • 0.78.0: 52ms

Example 2: timeit { mut x = 1; while $x < 1000000 { $x += 1 } }

  • 0.77.1: 1082ms
  • 0.78.0: 170ms

Optional cell path members (rgwood)

In Nu 0.78, you can use ? in cell paths to suppress errors from missing data. ? is a more convenient+powerful version of the -i/--ignore-errors flag on get and select. Here are some examples:

{ foo: 123 }.bar # errors because `bar` is not present on the record
{ foo: 123 }.bar? # returns null

{ foo: 123 } | get bar # errors
{ foo: 123 } | get bar? # returns null

{ foo: 123 }.bar.baz # errors
{ foo: 123 }.bar.baz? # errors because `bar` is not present
{ foo: 123 }.bar?.baz # returns null even though `baz` is not present; `?` short-circuits
{ foo: 123 }.bar?.baz? # returns null

[1, 2, 3].8 # errors because there is no 8th item in the list
[1, 2, 3].8? # returns null

[{foo: 123}, {}].foo # errors because `foo` is not present on every item in the table
[{foo: 123}, {}].foo? # returns a list [123, null]

? works anywhere that cell paths work, including where:

> [{foo: 123}, {}] | where foo? == 123
╭───┬─────╮
│ # │ foo │
├───┼─────┤
│ 0 │ 123 │
╰───┴─────╯

better error handling in error make (amtoine in #8511 and #8570)

The error make command now gives better hints about why the format is not a valid error make format:

  • with an empty format, error make {} will say that there is a "missing required member $.msg"
  • with an empty $.label, error make {msg: "message", label: {}} will say there is a "missing required member $.label.text"
  • finally, when $.label.start / $.label.end is not defined while the other is, error make will give a hint as to add the missing one to the format!

The second change disallow the use of a $.label.start greater than $.label.end as a span.

Support for pretty output format in to nuon (amtoine)

The to nuon command can now output pretty NUON data with whitespaces for better readability.

The default behaviour still is to output everything on a single line, encouraging users to leverage the compactness of the NUON data format.

However, we can now output formatted NUON data with the --indent and --tabs options:

> [1 2 3] | to nuon --indent 4
[
    1,
    2,
    3
]

or

> {date: 2000-01-01, data: [1 [2 3] 4.56]} | to nuon --indent 4
{
    date: 2000-01-01T00:00:00+00:00,
    data: [
        1,
        [
            2,
            3
        ],
        4.56
    ]
}

The default single-line behaviour still can be enforced with the --raw option, e.g.

> {date: 2000-01-01, data: [1 [2 3] 4.56]} | to nuon --indent 4 --raw
{date: 2000-01-01T00:00:00+00:00, data: [1, [2, 3], 4.56]}

New math exp command (lesves)

To complement the math ln command, we now include a math exp command for exponentiation with the base e.

Breaking changes

let requires surrounding parentheses for saving command output

let x = ls will not run the ls command anymore. If you need to save the output of a command, you need to wrap it in parentheses: let x = (ls).

|| now required in closures

To help differentiate between blocks (which can mutate variables) and closures (which can be used in a pipeline), we've changed the syntax of closures to require ||. This means the simplest closure now looks like {|| }

We no longer automatically print values as part of a script

We've changed the automatic-printing rules for scripts and the REPL to now only automatically print the last value. This means two major breaking changes:

  • We no longer automatically print loop values
  • We no longer print the results of every line automatically, requiring you to do it manually

Bare words can't start with a number

Words that start with a number or are in some way number-like must now must be wrapped in backticks to be treated at a bare word or wrapped in quotes to be a string.

Fields can only be defined once

You can no longer redefine a field in a record during initialization

Thread configuration moves to par-each

Nushell no longer accepts the -t/--threads flag to the binary as it's now part of par-each

Ranges become the standard range specifier

str substring now only accepts ranges as does bytes at.

Alias recursion has been disabled

Alias recursion is now disabled

Empty lists handled more consistently

[] | select foo now returns an empty list instead of null and sort, uniq, sort-by, and uniq-by now return empty lists when given an empty list (previously they would throw an error)

These changes make it easier to work with lists of unknown size.

Comparison operators now allow null

Previously expressions like 1 < null would error; now they return null.

Full changelog

Nushell

  • sholderbach created Pin reedline to 0.18.0 release, and Fix rest of license year ranges, and Remove unused atty dep in nu-table, and Bump version to 0.78.0, and Fix two stable clippy lints, and Remove proptests for nuon writing/parsing, and Add CONTRIBUTING section on PRs and git
  • fdncred created Update .gitignore, and fix test_default_config_path test after pr 8653, and fully deprecate str collect, and add a threads parameter to par_each, and fix inspect panic with large tables, and auto-expand paths in the $nu variable, and allow startup-time to be captured when starting nushell with nu -c, and tweak logging format, and Clarify how register works, and use reedline main branch, and fixes the ability to have multiple modifiers on keybindings, and make std.nu tests work on mac, and Revert "Allow NU_LIBS_DIR and friends to be const"
  • harshalchaudhari35 created Fix(tests/nu-command): remove unnecessary cwd() and pipeline(), etc
  • 1Kinoti created make bytes at use ranges, and fix unhelpful error message with '@' custom completion, and fix unhelpful error message with extra characters in list annotations, and type-check default values of list annotations, and unify the run functions of all and any, and fix: bytes length example description typo, and allow lists to have type annotations
  • sophiajt created give better error when a numberlike is used for strings, and prevent redefining fields in a record, and Add rest and ignore-rest patterns, and Remove CI coverage until we can figure out why it's broken, and move 'str substring' to only use ranges, and Improve inferred record types and type compat, and Improve number-like error if expecting a string, and Require that values that look like numbers parse as numberlike, and Add or-patterns, fix var binding scope, and Remove autoprinting of loop block values, and Speed up tight loop benchmarks, and Add more pattern types to matcher, and Move variables to var stack, and Fix closures that use matches. Move 'collect' to core., and Make timeit work with command calls, and Move timeit to use blocks. Make match vars immutable, and Add pattern matching, and Switch let/let-env family to init with math expressions, and Fix command missing hook default config, and Add rest and glob support to 'open', and bump to 0.77.2
  • amtoine created move the show_banner config field to the top, and REFACTOR: remove the redundant path expand from the tests of the standard library, and stdlib: fix the assert equal tests, and feature: add the standard library tests to the PR template and the toolkit, and stdlib: optimize test search and add better errors, and remove match from the standard library, and FIX: do not allow start > end in error make spans, and FIX: expand all the base_paths in std::test_dirs, and standard library: fix the readme, and standard library: bring the tests into the main CI, and FEATURE: write better errors for error make and complete the doc, and standard library: use the standard assert and fix test output, and standard library: fix the tests for the new closure parsing of 0.77.2
  • lesves created Add math exp command (issue #8661)
  • rgwood created Make optional cell paths work with reject, and Remove -t/--threads flag from nu, and Fix record-to-JSON conversion for HTTP commands, and Fix select on empty lists, and Change comparison operators to allow nulls, and Clean up unnecessary macro use, and Make HTTP requests cancellable when trying to connect, and Better error message for mv when file not found, and Cell paths: make optional path members short-circuit
  • kks110 created Fix a bug with us not outputting as µs with the into duration command, and Allow parsing of mu (µ) character for durations (issue #8614)
  • zhiburt created Fix of a fix of #8671
  • Benjamin-L created Support passing an empty list to sort, uniq, sort-by, and uniq-by (issue #5957)
  • stormasm created one more try on readme, and Add the showcase repo to Readme.md to give it more exposure to our developers, and remove unused imports: Deserialize, Serialize compiler warning for nu-protocol/src/example.rs
  • presidento created stdlib: Add back recursive lookup for tests, and stdlib: Implement common assert commands, and std lib: extend test runner capabilities
  • dependabot[bot] created Bump openssl from 0.10.45 to 0.10.48, and Bump actions-rust-lang/setup-rust-toolchain from 1.4.3 to 1.4.4, and Bump windows from 0.44.0 to 0.46.0, and Bump rstest from 0.16.0 to 0.17.0, and Bump quick-xml from 0.27.1 to 0.28.1, and Bump alphanumeric-sort from 1.4.4 to 1.5.0, and Bump miette from 5.5.0 to 5.6.0
  • StevenDoesStuffs created Fix mode tests which use sh to not run on windows
  • Sygmei created feat: added multiple options to http commands
  • jaudiger created Remove once_cell dependency from nu-test-support create.
  • WindSoilder created better error message if plugin name doesn't starts with nu_plugin_, and When running external command, expand tilde when pass back-quoted word
  • stevenxxiu created fix: set repl_buffer_state to the REPL buffer after the pre_execution hook
  • hyiltiz created Fix nu build script since for loops are stateful now
  • friedow created from ssv --aligned-columns should separate lines by character index instead of byte index
  • kubouch created Disable alias recursion (for real)
  • dandavison created Short redirection syntax
  • NotLebedev created Revert "Hide 7925"
  • sophiajt created parser: Add cell path literal syntax, and parser: Fix panic that happens when you type a single {, and Fix CI tests that landed after no-implicit-echo, and Fix parse of def with paren params, and Escape will now escape paths with '=' in them, and Start grouping parsing of values better
  • amtoine created REFACTOR: put all the standard library in std.nu, and DOC: make the README of the standard library clearer, and FEATURE: add a pretty output to toolkit check pr, and FEATURE: add --raw. --tabs and --indent to to nuon as in to json
  • rgwood created Add -i flag back to get and select, and Optional members in cell paths: Attempt 2
  • bgeron created Exit successfully from nu --help for compatibility with halp
  • hustcer created Fix docs building error caused by missing end tag
  • WindSoilder created Revert "Throw out error if external command in subexpression is failed to run (#8204)", and make better usage of error value in catch block, and Restrict closure expression to be something like {|| ...}, and make else if generate helpful error when condition have an issue
  • lucperkins created Add char --list example to char command docs
  • presidento created Make assert eq, assert ne consistent with ==, != operators, and standard library: add log commands, and stdlib: add test discovery, extract test files
  • nicokosi created docs: Use capital letters for CSV and JSON acronyms
  • dependabot[bot] created Bump mockito from 0.32.5 to 1.0.0
  • dandavison created SQL-style join command for Nushell tables
  • mdeville created Additional flags for commands from csv and from tsv
  • kubouch created Add proptest regression
  • uaeio created Decode and Encode hex
  • fdncred created enable error reporting from enable_vt_processing
  • initinll created Added fix for bug #8278 to read tag values from YAML files
  • Sygmei created fix: fixed typo and improved Value TypeMismatch exceptions
  • stevenxxiu created feat: add a command_not_found hook, and fix: fix commandline when called with no arguments
  • StevenDoesStuffs created Allow NU_LIBS_DIR and friends to be const
  • NotLebedev created Disable pipeline echo
  • alesito85 created Ls symlink fix

Extension

  • fdncred created fix use when it's used in variable name

Documentation

  • pingiun created Remove mention of 'env' command in environment.md, and Remove old 'env' command from configuration section
  • hustcer created fix #850, make make_docs.nu work for nu v0.77.2+, and Update plugin docs for v0.77
  • amtoine created add a note about better error make, and add #8366 to the release notes, and add a note about "value / description" completion
  • fdncred created change let config to let-env config, and show the list of combined keybinding modifiers
  • stevenxxiu created feat: docs on the command_not_found hook
  • presidento created Add chapter about testing in Nushell
  • petrisch created DE translation for command_signature, and DE translation for overlays
  • thomasgoulet created Add context aware custom completions to the book
  • alurm created Fix typos in book/stdout_stderr_exit_codes.md
  • aidalgol created Add "Coming from Bash" entries for discarding command output

Nu_Scripts

  • fdncred created replace occurrences of str collect with str join, and update to new nushell syntax, and update script syntax to match the latest nushell, and Update CODEOWNERS, and updated some scripts to support the latest changes in 0.77.1
  • fj0r created add parameters default value to just's completion and j for shortcut, and dp for docker ps support docker and podman
  • WindSoilder created Replace str collect with str join, and fix conda script
  • sophiajt created Update TWiN and since last release to 0.78
  • lesves created Removed math exp, it is now built-in
  • ankitgahlyan created typo
  • spitfire05 created Add gpsup, glo, git_current_branch, and Add gmom alias; add missing git_main_branch function
  • davidlattimore created git-completions: Add completions for more subcommands
  • Hofer-Julian created Add CODEOWNERS file, and conda: Disable prompt via env var instead of flag
  • sgasse created custom-completions: git: Include remote branches
  • amtoine created FIX: define a main function to use the themes modules
  • sholderbach created Fix since_last_release.nu script

reedline

  • sholderbach created Bump version for 0.18.0 release
  • fdncred created show the ability to have multiple modifiers
  • Hofer-Julian created Check typos in CI
  • jaudiger created Add const to some new functions., and Set MSRV to 1.62.1
  • ryanwhitehouse created Allow multi byte characters as the marker without panicking
Edit this page on GitHub
Contributors: Stefan Holderbach, Reilly Wood, amtoine, jntrnr, Jakub Žádník, fdncred, efulleratindeed, Maxim Uvarov, Justin Ma, Ian Manske, sophiajt