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.95.0

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.95.0 of Nu. This release adds external command parsing improvements, plugin version reporting, parse-time evaluation for many more string commands, constants for cache and data directories, and many bug fixes!

Where to get it

Nu 0.95.0 is available as pre-built binaries or from crates.io. If you have Rust installed you can install it using cargo install nu.

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

Table of content

  • Highlights and themes of this release
    • External command parsing improvements
    • Plugin version reporting
    • New $nu.data-dir and $nu.cache-dir constants
  • Changes to commands
    • Breaking changes
      • path type
      • to toml
      • help commands
      • str contains --not
      • sys
      • run-external
    • Deprecations
      • for --numbered
    • Other changes
      • String command parse-time evaluation
      • Range slice changes
      • from toml
      • sys users
      • into filesize
      • explore
  • All breaking changes
    • Notes for plugin developers
      • API
      • Protocol
  • Hall of fame
    • Bug fixes
  • Full changelog

Highlights and themes of this release [toc]

External command parsing improvements [toc]

Breaking change

See a full overview of the breaking changes

A lot of the quirks of external command parsing have been cleaned up in #13089, with most of the actual string handling work being moved into nu-parser itself. Previously, the parser was doing some very special things to create expressions in a way that run-external would then finish parsing in order to handle quotes in external options, globs, tilde expansion, etc., but this was error prone and did not have great test coverage.

Resolving this made it easier to find some of the edge cases that were not being handled, as well as making some syntax behave in a way that feels more consistent with the rest of Nushell:

  • Bare word interpolation works for external command options, and otherwise embedded in other strings:

    ^echo --foo=(2 + 2) # prints --foo=4
    ^echo -foo=$"(2 + 2)" # prints -foo=4
    ^echo foo="(2 + 2)" # prints (no interpolation!) foo=(2 + 2)
    ^echo foo,(2 + 2),bar # prints foo,4,bar
  • Bare word interpolation expands for external command head/args:

    let name = "exa"
    ~/.cargo/bin/($name) # this works, and expands the tilde
    ^$"~/.cargo/bin/($name)" # this doesn't expand the tilde
    ^echo ~/($name)/* # this glob is expanded
    ^echo $"~/($name)/*" # this isn't expanded
  • Ndots are now supported for the head/args of an external command (^.../foo works, expanding to ^../../foo)

    • Because our ndots handling requires path normalization, it is disabled for bare arguments that don't contain at least three consecutive dots, and for arguments that contain the string :// as that is likely to be a URL.
  • Glob values are now supported for head/args of an external command, and expanded appropriately:

    ^("~/.cargo/bin/exa" | into glob) # the tilde is expanded
    ^echo ("*.txt" | into glob) # this glob is expanded

Plugin version reporting [toc]

Breaking change

See a full overview of the breaking changes

Plugins can now report their own version to Nushell, and have it displayed in plugin list and version. This can help users understand exactly which plugin version they have active in their shell.

This is a breaking change for the Rust API, as implementing it on the Plugin trait is now required. We recommend the following implementation, which will take the plugin version directly from the cargo package metadata:

fn version(&self) -> String {
    env!("CARGO_PKG_VERSION").into()
}

If not using the Rust plugin API, you need to implement the new Metadata call. Providing a version is optional, but highly recommended.

New $nu.data-dir and $nu.cache-dir Constants

To standardize the locations for user-level items such as completions, the constant $nu.data-dir has been introduced in #13122. The default value of NU_LIB_DIRS will now be:

$env.NU_LIB_DIRS = [
    ($nu.default-config-dir | path join 'scripts') # add <nushell-config-dir>/scripts
    ($nu.data-dir | path join 'completions')       # default home for nushell completions
]

Data Directory Locations

If the $XDG_DATA_HOME environment variable is present when nushell is launched, and it is a valid path, then the data directory will $XDG_DATA_HOME/nushell. Otherwise, the location of the data directory will vary based on the operating system:

PlatformValueExample
Linux$HOME/.local/share/nushell/home/alice/.local/share/nushell
macOS$HOME/Library/Application Support/nushell/home/alice/Library/Application Support/nushell
Windows{FOLDERID_RoamingAppData}\nushellC:\Users\Alice\AppData\Roaming\nushell

Cache Directory Locations

Additionally, the constant $nu.cache-dir has been added for future use. Like the data directory, if the $XDG_CACHE_HOME variable is present and valid, then the location of the cache directory will be $XDG_CACHE_HOME/nushell. Otherwise, the location of the cache directory will vary based on the operating system:

PlatformValueExample
Linux$HOME/.cache/nushell/home/alice/.cache/nushell
macOS$HOME/Library/Caches/nushell/home/alice/Library/Caches/nushell
Windows{FOLDERID_LocalAppData}\nushellC:\Users\Alice\AppData\Local\nushell

New constants for system-level items such as $nu.vendor-autoload-dirs will be introduced in future releases.

Changes to commands [toc]

authortitlePR
@NotTheDr01dsSuppress column index for default cal output#13188
@NotTheDr01dsFixed generate command signature#13200
@ayax79Use polars default infer schema amount of 100 rows instead of scanning entire CSV/json lines files#13193
@zhiburtnu-explore: Add vertical lines && fix index/transpose issue#13147
@devynfix nu-system build on arm64 FreeBSD#13196
@NotTheDr01dsDo example#13190
@ayax79Added the ability to turn on performance debugging through and env var for the polars plugin#13191
@ayax79Added the ability to open json lines dataframes with polars lazy json lines reader.#13167
@NotTheDr01dsTable help rendering#13182
@fdncredupdate try command's help#13173
@weirdanUpdate sys users signature#13172
@WindSoilderImproves commands that support range input#13113
@NotTheDr01dsReturn an empty list when no std help --find results are found#13160
@NotTheDr01dsExpand tables in help examples in std#13146
@NotTheDr01dsAdded search terms to if#13145
@zhiburtImprove performance of explore - 1#13116
@NotTheDr01dsFixed help for banner#13138
@IanManskeRemove deprecated --not flag on str contains#13124
@fdncredupdate uutils crates#13130
@NotTheDr01dsFix multiple issues with def --wrapped help example#13123
@IanManskepath type error and not found changes#13007
@IanManskeRemove old sys command behavior#13114
@NotTheDr01dsDeprecate --numbered from for#13112
@ayax79Allow the addition of an index column to be optional#13097
@ayax79Fix the use of right hand expressions in operations#13096
@NotTheDr01dsFixes #13093 - Erroneous example in 'touch' help#13095
@IanManskeFix display formatting for command type in help commands#12996
@KAAtheWiseGitUse native toml datetime type in to toml#13018
@sholderbachMove format date to Category::Strings#13083
@rgwoodOverhaul explore config#13075
@rgwoodFix explore panic on empty lists#13074
@ayax79Upgrade to polars 0.40#13069
@NotTheDr01dscd/def --env examples#13068
@ayax79Allow int values to be converted into floats.#13025
@abuschMake query xml return nodes in document order#13047
@abuschTry to preserve the ordering of elements in from toml#13045
@hqszsupport plus sign for "into filesize"#12974
@rgwoodMake LS_COLORS functionality faster in explore, especially on Windows#12984
@IanManskeDisallow more characters in arguments for internal cmd commands#13009
@WindSoilderfix do closure with both required, options, and rest args#13002

Breaking changes [toc]

path type [toc]

After #13007, if the input path to path type is determined to not exist, path type will now return null instead of an empty string. In most cases, this should not require you to change your scripts. E.g., ("some/path" | path type) == dir will still work as intended.

However, if the input path type was not able to be determined, path type will now create an error instead of silently returning an empty string. For example, invalid permissions for a path will now report an error:

> '/root/test' | path type
Error: nu::shell::io_error

  × I/O error
   ╭─[entry #1:1:1]
 1 │ '/root/test' | path type
   · ──────┬─────
   ·       ╰── Permission denied (os error 13)
   ╰────

to toml [toc]

Thanks to @KAAtheWiseGit in #13018, to toml will now output nushell date values as toml date values instead of as toml strings.

help commands [toc]

In the last release, changes were made to the type column for scope commands and which. However, the command_type column for help commands was missed, and this release makes its output/formatting consistent with the other two commands. In particular, builtin will now be reported as built-in (#12996).

str contains --not [toc]

#13124 removes the --not flag on str contains. This flag was deprecated in the last release. You can check the previous release notes for migration examples.

sys [toc]

Last release deprecated the sys command in favor of new subcommands. In this release, the deprecated output of sys has been removed, and sys will now only report the available subcommands (#13114).

run-external [toc]

run-external now works more like any other command, without expecting a special call convention for its args:

> run-external echo "'foo'"
# 0.94: foo
# 0.95: 'foo'
> run-external echo "*.txt"
# 0.94: (glob is expanded)
# 0.95: *.txt

This argument handling is now implemented in the parser instead. See the previous section for more information on these changes.

Deprecations [toc]

for --numbered [toc]

Thanks to @NotTheDr01ds in #13112, the obscure --numbered flag on for has been deprecated. Instead, please use the enumerate command.

for x in ([bob fred] | enumerate) {
    print $'($x.index) is ($x.item)'
}

Other changes [toc]

String command parse-time evaluation [toc]

Thanks to @Embers-of-the-Fire in #13032, many more string-related commands can now be run during parse-time (i.e., used with const). This includes:

  • str trim
  • str contains
  • str distance
  • str ends-with
  • str expand
  • str index-of
  • str join
  • str replace
  • str reverse
  • str starts-with
  • str stats
  • str substring
  • str capitalize
  • str downcase
  • str upcase
  • split chars
  • split column
  • split list
  • split row
  • split words
  • format date
  • format duration
  • format filesize
  • parse
  • detect columns
  • encode
  • decode

Range slice changes [toc]

In #13113, str substring and bytes at were changed so that they no longer error if the end range index is greater than the start range index. Instead, an empty string or binary value will be returned. For example, this can happen if the end index is negative:

"aaa" | str substring 2..-3

from toml [toc]

Thanks to @abusch in #13045, from toml will now preserve the order of keys/entries as they appear in the input.

into filesize [toc]

Thanks to @hqsz in #12974, into filesize can now parse (more) strings that start with a plus sign. In #13110, they also fixed a bug caused by integer casting.

sys users [toc]

Thanks to @weirdan in #13172, the signature of sys users has been fixed. It used to say that a record would be returned, but sys users actually returns a table.

explore [toc]

#13074 fixes a bug where explore would panic on an empty list.

All breaking changes [toc]

authortitlePR
@NotTheDr01dsSuppress column index for default cal output#13188
@IanManskeRemove deprecated --not flag on str contains#13124
@IanManskepath type error and not found changes#13007
@IanManskeRemove old sys command behavior#13114
@NotTheDr01dsDeprecate --numbered from for#13112
@kubouchSpan ID Refactor (Step 2): Use SpanId of expressions in some places#13102
@IanManskeFix display formatting for command type in help commands#12996
@KAAtheWiseGitUse native toml datetime type in to toml#13018

Notes for plugin developers [toc]

API [toc]

  • The Plugin trait now has a required method fn version(&self) -> String. The following implementation should suffice in most cases:
    fn version(&self) -> String {
        env!("CARGO_PKG_VERSION").into()
    }
  • A new derive macro has been added (#13031) for FromValue and IntoValue conversion traits to make serialization to and from Nushell values easier. The API design is similar to serde-derive. We expect this to make certain kinds of plugins much easier to develop! Many thanks to @cptpiepmatz.

Protocol [toc]

  • The plugin protocol has a new required call, Metadata, which is currently used to report version information on registration, but may be used for other plugin metadata in the future. The intention is that all fields are optional, and version is currently optional. This means that although the Rust API requires a version to be reported, it is perfectly allowed (but not recommended) for a plugin to not report a version.

Hall of fame [toc]

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

Bug fixes [toc]

authortitlePR
@ayax79Use polars default infer schema amount of 100 rows instead of scanning entire CSV/json lines files#13193
@weirdanUpdate sys users signature#13172
@WindSoilderImproves commands that support range input#13113
@devynFix compilation for nu_protocol::value::from_value on 32-bit targets#13169
@NotTheDr01dsReturn an empty list when no std help --find results are found#13160
@NotTheDr01dsFixed help for banner#13138
@kubouchFix delta not being merged when evaluating menus#13120
@hqszfix wrong casting with into filesize#13110
@WindSoilderrun_external: remove inner quotes once nushell gets = sign#13073
@rgwoodFix explore panic on empty lists#13074
@hqszsupport plus sign for "into filesize"#12974
@rgwoodMake LS_COLORS functionality faster in explore, especially on Windows#12984
@IanManskeDisallow more characters in arguments for internal cmd commands#13009
@WindSoilderfix do closure with both required, options, and rest args#13002

Error messages

authortitlePR
@IanManskepath type error and not found changes#13007
@hqszsupport plus sign for "into filesize"#12974
@ayax79Fixed incorrect parquet error messages for CSV files#13043
@IanManskeDisallow more characters in arguments for internal cmd commands#13009

Dataframes

authortitlePR
@ayax79Use polars default infer schema amount of 100 rows instead of scanning entire CSV/json lines files#13193
@ayax79Added the ability to turn on performance debugging through and env var for the polars plugin#13191
@ayax79Added the ability to open json lines dataframes with polars lazy json lines reader.#13167
@ayax79Allow the addition of an index column to be optional#13097
@ayax79Fix the use of right hand expressions in operations#13096
@ayax79Upgrade to polars 0.40#13069
@ayax79Allow int values to be converted into floats.#13025
@ayax79Fixed incorrect parquet error messages for CSV files#13043

Full changelog [toc]

  • devyn created
    • Mitigate the poor interaction between ndots expansion and non-path strings
    • Allow plugins to report their own version and store it in the registry
    • Add shape_glob_interpolation to default_config.nu
    • fix nu-system build on arm64 FreeBSD
    • Move most of the peculiar argument handling for external calls into the parser
    • Change the error style during tests to plain
    • Fix compilation for nu_protocol::value::from_value on 32-bit targets
    • Add options for filtering the log output from nu
    • msgpackz: increase default compression level
    • Fix run_external::expand_glob() to return paths that are PWD-relative but reflect the original intent
    • Fix external command name parsing with backslashes, and add tests
    • Bump version to 0.94.2
    • Restore tilde expansion on external command names
    • Bump version to 0.94.1
  • weirdan created
    • Fix usage parsing for commands defined in CRLF (windows) files
    • Update sys users signature
  • cptpiepmatz created
    • Allow missing fields in derived FromValue::from_value calls
    • Add derive macros for FromValue and IntoValue to ease the use of Values in Rust code
  • NotTheDr01ds created
    • Suppress column index for default cal output
    • Fixed generate command signature
    • Do example
    • Table help rendering
    • Return an empty list when no std help --find results are found
    • Expand tables in help examples in std
    • Added search terms to if
    • Fixed help for banner
    • Fix multiple issues with def --wrapped help example
    • Deprecate --numbered from for
    • Fixes #13093 - Erroneous example in 'touch' help
    • cd/def --env examples
  • ayax79 created
    • Use polars default infer schema amount of 100 rows instead of scanning entire CSV/json lines files
    • Added the ability to turn on performance debugging through and env var for the polars plugin
    • Added the ability to open json lines dataframes with polars lazy json lines reader.
    • Allow the addition of an index column to be optional
    • Fix the use of right hand expressions in operations
    • Upgrade to polars 0.40
    • Allow int values to be converted into floats.
    • Fixed incorrect parquet error messages for CSV files
  • zhiburt created
    • nu-explore: Add vertical lines && fix index/transpose issue
    • Improve performance of explore - 1
  • fdncred created
    • add a system level folder for future autoloading
    • update try command's help
    • add $nu.data-dir for completions and $nu.cache-dir for other uses
    • update uutils crates
    • fixes a bug in OSC9;9 execution
  • app/dependabot created
    • Bump actions/checkout from 4.1.6 to 4.1.7
    • Bump interprocess from 2.1.0 to 2.2.0
    • Bump git2 from 0.18.3 to 0.19.0
    • Bump crate-ci/typos from 1.22.4 to 1.22.7
    • Bump actions-rust-lang/setup-rust-toolchain from 1.8.0 to 1.9.0
    • Bump crate-ci/typos from 1.22.1 to 1.22.4
    • Bump os_pipe from 1.1.5 to 1.2.0
    • Bump crate-ci/typos from 1.22.0 to 1.22.1
    • Bump hustcer/setup-nu from 3.10 to 3.11
    • Bump crate-ci/typos from 1.21.0 to 1.22.0
  • WindSoilder created
    • Improves commands that support range input
    • run_external.rs: use pathdiff::diff_path to handle relative path
    • run_external: remove inner quotes once nushell gets = sign
    • bump version to 0.94.3
    • fix do closure with both required, options, and rest args
  • edwinjhlee created
    • Update README.md
  • IanManske created
    • Make which-support feature non-optional
    • Remove deprecated --not flag on str contains
    • path type error and not found changes
    • Remove old sys command behavior
    • Fix display formatting for command type in help commands
    • Disallow more characters in arguments for internal cmd commands
    • Restore path type behavior
  • kubouch created
    • Fix delta not being merged when evaluating menus
    • Extend functionality of tango benchmark helpers
    • Span ID Refactor (Step 2): Use SpanId of expressions in some places
    • Fix test failure when running tests with nextest
    • Span ID Refactor - Step 1
  • hqsz created
    • fix wrong casting with into filesize
    • support plus sign for "into filesize"
  • ymcx created
    • Fix the colors when completing using a relative path
  • Decodetalkers created
    • fix: coredump without any messages
  • KAAtheWiseGit created
    • Use native toml datetime type in to toml
  • sholderbach created
    • Group polars crate updates in dependabot
    • Move format date to Category::Strings
  • JoaoFidalgo1403 created
    • Allow stor insert and stor update to accept pipeline input
  • rgwood created
    • Overhaul explore config
    • Fix explore panic on empty lists
    • Refactor explore cursor code
    • Make LS_COLORS functionality faster in explore, especially on Windows
  • roaldarbol created
    • Create CITATION.cff
  • Embers-of-the-Fire created
    • Make string related commands parse-time evaluatable
  • stormasm created
    • reduce log tracing in nu-cli
  • abusch created
    • Make query xml return nodes in document order
    • Try to preserve the ordering of elements in from toml
  • amtoine created
    • complete the type of --error-label in std assert commands
  • YizhePKU created
    • Remove std::env::set_current_dir() call from EngineState::merge_env()
Edit this page on GitHub
Contributors: Ian Manske, Devyn Cairns, Jakub Žádník, Jack Wright, Lars Francke, Alexandre GV., Jan Klass