Nushell 0.83
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.83 of Nu. This release adds match guards, stronger type checking features, unit testing improvements, flexible variable initializations, and more.
Where to get it
Nu 0.83 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
Fixes, stabilization and shoutouts
Name | Link | Description |
---|---|---|
@WindSoilder | 9747 | Redirection: make o> , e> , o+e> 's target support variables and string interpolation |
@kubouch | 9679 | Fix broken constants in scopes |
@rusty-jules | 9594 | Fix: return all headers with the same name from http <method> |
@baehyunsol | 9582 | make the behaviours of last and first more consistent |
@hanjunghyuk | 9623 | Fix explore crashes on {} |
@YassineHaouzane | 9616 | Fix: update engine_state when history.isolation is true (#9268) |
@IanManske | 9603 | Fix headers command handling of missing values |
@AyushSingh13 | 9580 | fixes which showing aliases as built-in nushell commands |
@mengsuenyan | 9662 | fix the command cp -u src dst /mv -u src dst doesn't work when the… |
Changes to commands
Since last release, some commands have changed and some have been created, here is a list of some changes and what they mean:
- @amtoine in #9646:
which
returns the type of the command instead of only whether it is builtin or not and uses more explicit column names - @atahabaki in #9750:
str expand
now allows empty member in brace expansion, e.g.A{,B,C}
would expand to[A, AB, AC]
- @fdncred in #9669:
keybinding listen
gives more information about keys likehome
andend
, namely theirkind
andstate
- @NotLebedev in #9453:
input listen
allows to query for a single key press, e.g. the following will take a 4-char input1..4 | each { input listen } | where key_type == char | get code | str join
- @kubouch in #9687:
path
commands lose the-c
flag; instead, useupdate
to update table columns
Command set refinement efforts
Again with this new release, we are continuing refining our set of core commands. As part of this, another set of commands have moved to extra
. Thanks to folks who are helping our efforts on the road to 1.0!
Note No command has been removed completely, they have just been moved in the extra feature of Nushell. simply use
cargo ... --features extra
to reenable them.
Math commands have been moved by @stormasm in #9674, #9657 and #9647 and the following commands have been moved in #9404: fmt
, each while
, roll
, roll down
, roll left
, roll right
, roll up
, rotate
, update cells
, decode hex
, encode hex
, from url
, to html
, ansi gradient
, ansi link
and format
Language improvements
Since last release, a few changes have happened to the Nu language itself.
Declaration and assignment of variables
Until now, declaration keywords such as let
and mut
have required the use of parentheses around pipelines to assign the output of a chain of command to a variable. Thanks to @sophiajt in #9658 and #9589, this syntax has been relaxed for let
and mut
. Let's give some examples!
let filenames = ls | where type == file | get name
and
mut my_var = "hello world" | str length
are now completely valid Nushell code.
Note this new syntax does not work on
const
and it does not apply to assignment of values to variables, e.g.$env.FILENAMES = ls | where type == file | get name
is not parsed as valid Nushell.
Another parser improvement has to do with the use of if
and match
in variable assignment. In #9650, @Windsoilder made the following Nushell snippets possible:
mut a = 3
$a = if 4 == 3 { 10 } else {20}
and
$env.BUILD_EXT = match 3 { 1 => { 'yes!' }, _ => { 'no!' } }
Input / output type checking and annotations (@sophiajt)
Nushell as a language is more strictly typed than other shell languages. However, not everything was type-checked nor possible to annotate and this new release tries to fill this gap a bit more.
Note in the following of this section, the term input / output signature is used. This describes the input of a command and the associated output type of the command for the given input type, e.g. in
ls | get 0.name
the input type ofget
is atable
and its output type is astring
, so we can say that the input / output signature ofget
here istable -> string
.Please note that input / output signatures always come in pair.
First, #9686 makes the input / output type signatures clearer in the help pages of commands. Then, #9690 and #9680 enable input / output type annotations on custom commands and enforce a strong type checking on the input and output of commands. This means a few things
- the input / output of custom commands can be annotated
def sum []: list<int> -> int {
math sum
}
- some type-invalid calls to commands are now parsed as an error, e.g.
123 | get foo
gives the following error
Error: nu::parser::input_type_mismatch
× Command does not support int input.
╭─[entry #2:1:1]
1 │ 123 | get foo
· ─┬─
· ╰── command doesn't support int input
╰────
This is still a work in progress, so some commands might have incorrect or missing input / output type annotations 😮 This is expected and we worked and are working on this to fix all incorrect signatures (#9755, #9749, #9707, #9706, #9695, #9683, #9775, #9741, #9742, #9739 and #9778)!
Shoutouts
In between the two releases, @1Kinoti has worked on some nice improvements to the language
- match guards have been added to the
match
command in #9621 table
types can now have parameters, just asrecord
s andlist
s can, thanks to #9613- structural subtyping has been improved in #9614 and allow to match structured types regardless of the orders of the fields
Configuration tweaks
Contributions have been made to give a more consistent and sensible default experience in Nushell, both when using the default_config.nu
config file or when not having a config, e.g. with nu -n
. A better right prompt has been written in #9585 and #9581 and the default configuration has been polished in #9676.
The standard library
The biggest topic in this 0.83 release for the standard library has been the test runner!
Thanks to @Yethal, the test runner of the standard library can now use annotations to decide whether or not to run a command as part of the test suite of a project: #9628, #9622, #9611 and #9406.
For instance, we can now write a module as follows
def add [a: int, b: int] {
$a + $b
}
#[test]
def addition [] {
use std assert
assert equal (add 1 2) 3
}
and std testing run-tests
would successfully run the addition
test, no need to define tests with test_
in their names!
Thanks to @Hofer-Julian (#9607), the standard library now also comes with a pwd
command that tells you were you are in the filesystem.
Breaking changes
PLEASE NOTE: there are some big breaking changes in this release. These include:
- Removal of
let-env
(now use the$env.FOO = "BAR"
form instead) - Stricter checking of input/output types
- Transitioning of a set of commands to now be available via
extra
feature rather than default
Full list of breaking changes:
- #9574 remove let-env, focus on mutating $env
- #9587 disallow blocks as first-class values
- #9589
let
no longer allows bareword assignment (Eg,let foo = bar
wherebar
is assumed to be a string) - #9582 make the behaviours of
last
andfirst
more consistent - #9594 Fix: return all headers with the same name from
http <method>
- #9646 change the output of
which
to be more explicit - #9404 #9647 #9657 - a number of commands have been moved to
extra
- #9680 Input output checking
- #9613 allow table types to have parameters
- #9687 Refactor path commands
- #9690 The
extern
command has split intoextern
andextern-wrapped
, the latter allowing a block to be called when calling an extern
Full changelog
Nushell
- sholderbach created
- Adjust signatures for cellpath access of tables
- Update
nu-ansi-term
,lscolors
, andreedline
- Abort type determination for List early
- Fix output signature of
split chars
/words
- Use explicit in/out list types for vectorized commands
- Add explicit input types for vectorized
into int
form - Remove underused devdep
getset
- Clean up tests containing unnecessary
cwd:
tokens - Use
is-terminal
crate for now - Bump deps to transitively use hashbrown 0.14
- Apply nightly clippy lints
- Update reedline dev version lock
- Bump
indexmap
to 2.0 - Remove duplicated dependency on
ansi-str 0.7
- Update
proc-macro2
lock, fix nightly build - Exclude deprecated commands from completions
- Document
fn pipeline()
used withnu!
tests - Remove unnecessary parentheses
- app/dependabot created
- Bump pretty_assertions from 1.3.0 to 1.4.0
- Bump tempfile from 3.6.0 to 3.7.0
- Bump miette from 5.9.0 to 5.10.0
- Bump strum_macros from 0.24.3 to 0.25.1
- Bump strum from 0.24.1 to 0.25.0
- Bump scraper from 0.16.0 to 0.17.1
- Bump libproc from 0.13.0 to 0.14.0
- Bump tempfile from 3.5.0 to 3.6.0
- Bump calamine from 0.19.1 to 0.21.2
- Bump ureq from 2.6.2 to 2.7.1
- Bump open from 4.1.0 to 5.0.0
- amtoine created
- add
table -> table
tointo datetime
- change the output of
which
to be more explicit - add
any -> record
tometadata
- sync default config / env with default behaviour without any configuration
- allow
into filesize
to take tables as input / output - simplify the test for
let
core command - fix the
std
test commands calls in dev documents - refactor the CI
- REFACTOR: move the 0% commands to
nu-cmd-extra
- simplify the
nu!
tests forlast
andfirst
commands
- add
- hexavik created
- mengsuenyan created
- IanManske created
- fdncred created
- update history_isolation to false
- change the default of history.isolation
- handle sqlite tables better by surrounding with brackets
- add range input to par-each
- normalize default_config/env formatting
- allow range as a input_output_type on filter
- update rust toolchain to 1.69.0
- add more input_output_types found from breaking scripts
- add kind and state to other key presses
- fix right prompt in the default_env.nu
- fix typo in deprecated message:
$nu
should be$env
- update ide-check help text
- add input_output type to
input list
to return string - convert a string to a raw binary string of 0s and 1s
- update sqlparser dep to 0.34
- atahabaki created
- sophiajt created
- Fix capture logic for inner closures
- fix input signature of let/mut
- Revert "Fix SIGTTIN handling"
- Custom command input/output types
- Change input/output types in help to a table
- Input output checking
- Remove broken compile-time overload system
- allow mut to take pipelines
- Move to using a safer shell integration default setting
- Let with pipeline
- disallow blocks as first-class values
- use an easier-to-read date format in prompt
- fix a few clippy issues
- remove let-env, focus on mutating $env
- Improve type hovers
- cramt created
- WindSoilder created
- Redirection: make
o>
,e>
,o+e>
's target support variables and string interpolation - support env assignment and mutable variable assignment with
if
block andmatch
guard - dependency: use notify-debouncer-full(based on notify v6) instead of notify v4
- Bracketed paste refactor
- fix cd permissions when user belongs to folder group
rename
: add -b flag to support closure input
- Redirection: make
- stormasm created
- dmatos2012 created
- nibon7 created
- 1Kinoti created
- kubouch created
- zhiburt created
- hanjunghyuk created
- Yethal created
- AyushSingh13 created
- YassineHaouzane created
- Hofer-Julian created
- NotLebedev created
- rusty-jules created
- baehyunsol created
- bgmort created
Extension
Documentation
- amtoine created
- Heidar-An created
- JoaquinTrinanes created
- fachammer created
- hustcer created
- Equationzhao created
- Hofer-Julian created
- jarrodu created
- sholderbach created
- waldyrious created
Nu_Scripts
- amtoine created
- sophiajt created
- JalonWong created
- fj0r created
- fdncred created
- maxim-uvarov created
- trantor created
- dedebenui created
- bobhy created
Reedline
- sholderbach created
- nibon7 created
- NotLebedev created
- WindSoilder created