Nushell 0.97.1
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.97.1 of Nu. This release makes parsing of assignments more consistent, enhances path completions, and includes many enhancements to commands.
Note: this was going to be version 0.97.0, but that version had to be yanked due to a last minute bug. This is still the next major version, not a patch release.
Where to get it
Nu 0.97.1 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
- Changes to commands
- All breaking changes
- Notes for plugin developers
- Hall of fame
- Full changelog
Highlights and themes of this release [toc]
More consistent parsing of assignment [toc]
Breaking change
See a full overview of the breaking changes
The assignment operators and const
have been changed (#13385) to better reflect the behavior used by let
and mut
. Before 0.97, these two statements would have been interpreted very differently:
mut num = 2 | $in * 4
# equivalent to: mut num = (2 | $in * 4)
$num = 2 | $in * 4
# equivalent to: ($num = 2) | $in * 4
Because assignment operators were parsed just like any other operator, they didn't absorb the rest of the pipeline or run commands the same way that let
and mut
do, so parentheses were often necessary. This has been changed so that the latter example is now equivalent to $num = (2 | $in * 4)
instead. The following are also now all possible, and would have been errors before:
# $path will be set to 'a/b'
const path = 'a' | path join 'b'
mut x = 2
# $x will be set to a random integer
$x = random int
# $x will be set to 6
# previously `math sum` would have received nothing input
$x = [1 2 3] | math sum
# $env.FOO will be set to a random string
$env.FOO = random chars
However, this also introduces a pretty major breaking change. The following would have set variables to strings before:
const foo = bar # 'bar'
$quux += baz # appends 'baz'
$env.FOO = `C:\foo\bar\baz.exe`
With the new change, these would all be interpreted as commands instead. To try to make this less surprising, we have decided to require the caret (^
) to be used when invoking external commands from a bare word on the right hand side of an assignment (alone, not within parentheses). Failing to use the caret causes a parse error. If you intend to run the command, simply add the caret:
$env.FOO = ^`C:\foo\bar\baz.exe`
Otherwise, consider using a type of string that doesn't cause command execution:
$env.FOO = 'C:\foo\bar\baz.exe'
Enhancements to path completions [toc]
Breaking change
See a full overview of the breaking changes
Thanks to @lavafroth in #13302, path completions now explicitly check for and prefer an exact match for a basename instead of longer or similar names.
Also, thanks to @lyuha in #13321, when completing paths on Windows, the last path separator in use will now be preserved. If the path was most recently using forward slashes, the completion will suggest a forward slash, but if it was using backslashes (as is conventional for Windows), it will continue to suggest backslashes. This should make things a bit more ergonomic for those who prefer to use forward slashes on Windows.
Changes to commands [toc]
Additions [toc]
random binary
[toc]
Thanks to @KAAtheWiseGit in #13542, the random binary
command was added. This command has one required parameter which is the number of bytes to generate.
> random binary 16
Length: 16 (0x10) bytes | printable whitespace ascii_other non_ascii
00000000: 28 99 b7 0e c0 2f 02 0c d8 5a b9 69 72 36 86 30 (×ו×/•_×Z×ir6×0
mv --update
[toc]
In #13505, @Embers-of-the-Fire added the --update
/-u
flag to mv
. This has the same behavior/purpose as the --update
flag on cp
. Namely:
move and overwrite only when the SOURCE file is newer than the destination file or when the destination file is missing
print --raw
[toc]
In #13597, the --raw
flag was added to print
. This will bypass any pretty formatting from table
and instead write data directly to stdout or stderr.
polars save
[toc]
The polars sink
and polars to-*
commands have been merged (#13568) into a single command, polars save
. This change helps to choose the most efficient option possible for lazyframes, allowing them to stream out to disk when supported.
multipart/form-data [toc]
In #13532, thanks to @weirdan, the http post
command now supports the multipart/form-data
content type.
Breaking changes [toc]
ps
[toc]
Thanks to @qfel, after #13618, the name column from the ps
command will now contain the name of the process instead of its path.
ls
[toc]
After #13479, the --full-paths
/-f
flag for ls
will cause the paths in the target
column to be fully qualified paths.
stor
[toc]
Thanks to @maxim-uvarov in #13464, stor
no longer implicitly removes ansi escape sequences from strings that will be stored.
save
[toc]
Streams from external commands will now (#13422) have their stderr printed to nu
's stderr, if captured but not used.
polars open
[toc]
polars open
will now open a lazyframe by default (#13556). The --lazy
option has been removed, and --eager
has been added instead, to explicitly open an eager dataframe.
Removals [toc]
polars to-*
[toc]
The polars to-*
commands have been superseded by polars save
.
Bug fixes and other changes [toc]
const math commands [toc]
In #13566, @Qnbie has made more math commands usable in constant evaluation:
math abs
math avg
math ceil
math floor
math log
math max
math median
math min
math mode
math product
math round
math stddev
math sqrt
(#13487)math sum
math variance
glob
accepts globs [toc]
After #13612, glob
now also takes globs (in addition to strings) as the first parameter.
into datetime
[toc]
Thanks to @NotTheDr01ds in #13541, integer values can now be piped into into datetime
in combination with a format string. The integers will be interpreted based on the format string. Example:
1724112000 | into datetime -f '%s'
# => Tue, 20 Aug 2024 00:00:00 +0000 (now)
reduce
[toc]
Thanks to @Bahex in #13461, the accumulator argument is now also passed as pipeline input to the closure provided to reduce
.
split words
[toc]
Thanks to @weirdan in #13502, split words
no longer removes digits and instead treats them as part of a word.
query web
[toc]
Thanks to @Embers-of-the-Fire, some potential panics for query web
were fixed in #13507.
Additionally, thanks to @jameschensmith in #13538, an issue with values appearing in the wrong column due to missing data was fixed.
All breaking changes [toc]
- #13618 Prefer process name over executable path
- #13568 Merge
polars sink
andpolars to-*
topolars save
- #13556
polars open
will now open a lazy frame by default - #13302 feat: prefer exact match when completion mode is prefix
- #13422 save: print to stderr for bytestream
- #13385 Make assignment and
const
consistent withlet
/mut
- #13464 don't force stripping ansi codes from strings in
stor
- #13181 feat: make ctrlc available to plugins
Notes for plugin developers [toc]
Interrupt signals for plugins [toc]
Interrupt (ctrl-C) signals are now available to plugins, thanks to @cablehead in #13181. The EngineInterface::register_signal_handler
method is used to set up a handler for interrupt & clear signals. A new plugin input message, Signal
, has been added to support this functionality. For non-Rust plugins, please be sure to add support for this message as appropriate.
Pipeline metadata added to protocol [toc]
The metadata of PipelineData
has been added to the protocol in #13495, ensuring that metadata can be preserved across plugin calls, or used by plugins as appropriate.
This required some pretty significant changes to PipelineDataHeader
, with Value
now being a tuple variant, and the ListStreamInfo
and ByteStreamInfo
now containing metadata
fields. Non-Rust plugins will definitely need to be updated to be compatible with this change. Please check that your plugins conform to the updated documentation. There are no API changes to nu-plugin
required, so Rust plugins should just need to be recompiled.
Hall of fame [toc]
Thanks to all the contributors below for helping us solve issues and improve documentation 🙏
author | title | PR |
---|---|---|
@ysthakur | Fix bug introduced by #13595 | #13658 |
@fdncred | add more helpful error with text/xml | #13609 |
@WindSoilder | make ls -lf outputs full path in symbolic target | #13605 |
@ysthakur | Parse time type checking for range | #13595 |
@sholderbach | Include only *.nu files in the vendor autoload | #13599 |
@jameschensmith | Include empty table data cells in query web tables | #13538 |
@Embers-of-the-Fire | Fix overflow table display in command documentation | #13526 |
@Embers-of-the-Fire | Fix internal panic for query web | #13507 |
Full changelog [toc]
- ayax79 created
- bumped version number to 0.97
- Incrementing the eager dataframe cache value before returning it
- Merge
polars sink
andpolars to-*
topolars save
- Added
polars sink
command, that performs and streaming collect to t… polars first
andpolars last
will now handle lazy frames nativelypolars open
will now open a lazy frame by default- Attempt to guess the content type of a file when opening with --raw
- Adding plist support
- Make pipeline metadata available to plugins
- setting content type metadata on all core
to *
commands
- IanManske created
- weirdan created
- fdncred created
- qfel created
- sholderbach created
- Remove code duplication in glob
- Include only
*.nu
files in the vendor autoload - Bump typo with new ignore
- Rework
help
generation internals - Fixup #13526 width flag for example
- Replace manual
Record::get
implementation - Lift
SharedCow::to_mut
out of if let branches - Simplify column look-up in
default
- Contentious clippy fixes
- Clippy fixes from stable and nightly
- Bump rust toolchain
- Clippy fixes for toolchain bump
- Create security policy
- app/dependabot created
- Bump indexmap from 2.3.0 to 2.4.0
- Bump shadow-rs from 0.30.0 to 0.31.1
- Bump sysinfo from 0.30.11 to 0.30.13
- Bump mockito from 1.4.0 to 1.5.0
- Bump quick-xml from 0.31.0 to 0.32.0
- Bump scraper from 0.19.0 to 0.20.0
- Bump indexmap from 2.2.6 to 2.3.0
- Bump similar from 2.5.0 to 2.6.0
- Bump crate-ci/typos from 1.23.3 to 1.23.5
- Bump shadow-rs from 0.29.0 to 0.30.0
- Bump openssl from 0.10.64 to 0.10.66
- Bump crate-ci/typos from 1.23.2 to 1.23.3
- Bump softprops/action-gh-release from 2.0.6 to 2.0.8
- WindSoilder created
- ysthakur created
- Aakash788 created
- playdohface created
- devyn created
- Qnbie created
- NotTheDr01ds created
- kurokirasama created
- KAAtheWiseGit created
- cablehead created
- jameschensmith created
- lavafroth created
- Embers-of-the-Fire created
- maxim-uvarov created
- Bahex created
- suimong created
- userwiths created
- lyuha created