Nushell 0.75
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.75 of Nu. This release extends our unicode support, renames some important HTTP-related commands, and improves our module system. It also contains a good amount of polish and refactoring behind the scenes.
Where to get it
Nu 0.75 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
Changed Unicode escapes in strings (bobhy)
Warning
Breaking Change: You need to update escapes like "\u0043"
to "\u{0043}"
New format:
〉echo "AB\u{43}\u{044}"
ABCD
〉echo "Gabriel, blow your \u{1f3BA}"
Gabriel, blow your 🎺
Instead of:
〉echo "AB\u0043"
ABC
This format allows you to insert any Unicode code point into a string by specifying its value as 1 through 6 hex digits (with or without leading zeros, upper or lower case). The maximum value is \u{10ffff}
, which is the largest Unicode code point defined.
We've simply dropped support for the old format since we're pre-1.0 and didn't want to carry forward redundant syntax. You will have to change any unicode escapes in your scripts to the new format.
Why change? The old 4-digit syntax could not natively address recent extensions to Unicode standard, such as emoji, CJK extension and traditional scripts. There is a cumbersome workaround in the form of surrogate pairs, but this is not intuitive.
Why this change? The new format allows you to specify any Unicode code point with a single, predictable syntax. Rust and ECMAScript 6 support the same syntax. (Full disclosure: C++, Python and Java don't.)
-g
grapheme cluster flags for str length
, str substring
, str index-of
, split words
and split chars
(webbedspace)
As you know, str length
, str substring
, str index-of
and split words
measure the length of strings and substrings in UTF-8 bytes, which is often very unintuitive - all non-ASCII characters are of length 2 or more, and splitting a non-ASCII character can create garbage characters as a result. A much better alternative is to measure the length in extended grapheme clusters. In Unicode, a "grapheme cluster" tries to map as closely as possible to a single visible character. This means, among many other things:
- Non-ASCII characters, such as
ん
, are considered single units of length 1, no matter how many UTF-8 bytes they use. - Combined characters, such as
e
and◌́
being combined to produceé
, are considered single units of length 1. - Emojis, including combined emojis such as 🇯🇵, which is made of the 🇯 and 🇵 emojis plus a zero-width joiner, are considered single units of length 1. (This is a property of "extended" grapheme clusters.)
"\r\n"
is considered a single unit of length 1.
The new --graphemes
/-g
flag can be used with str length
, str substring
, str index-of
and split words
to enable these length/indexing measurements:
〉'🇯🇵ほげ ふが ぴよ' | str substring 4..6 -g
ふが
〉'🇯🇵ほげ ふが ぴよ' | str length -g
9
〉'🇯🇵ほげ ふが ぴよ' | str index-of 'ふが' -g
4
In addition, the flag has been added to split chars
. Notably, this command splits on Unicode code points rather than UTF-8 bytes, so it doesn't have the issue of turning non-ASCII characters into garbage characters. However, combining emoji and combining characters do not correspond to single code points, and are split by split chars
. The -g
flag keeps those characters intact:
〉'🇯🇵ほげ' | split chars -g | to nuon
[🇯🇵, ほ, げ]
These commands also have --utf-8-bytes
/-b
flags which enable the legacy behavior (and split chars
has --code-points
/-c
). These currently do not do anything and need not strictly be used, since UTF-8 byte lengths are still the default behaviour. However, if this default someday changes, then these flags will guarantee that the legacy behaviour is used.
Tips
It is currently being debated whether or not grapheme clusters should be used as the default string length measurement in Nushell (making the -g
flag the default behaviour for these commands), due to their intuitiveness, consistency across non-Latin scripts, and better correspondence to the length of strings displayed in the terminal (after stripping ANSI codes). Currently, the Nushell developers are uncertain what the long-term impact of such a change would be, whether existing scripts would be non-trivially harmed by it, or whether it would hinder interoperability with external programs. If you have any personal insight or opinion about this change, or about which behaviour you'd prefer not to require a flag, your input is desired!
New enumerate
command (Sophia)
A new enumerate
command will enumerate the input, and add an index and item record for each item. The index is the number of the item in the input stream, and item is the original value of the item.
> ls | enumerate | get 14
╭───────┬────────────────────────────╮
│ index │ 14 │
│ │ ╭──────────┬─────────────╮ │
│ item │ │ name │ crates │ │
│ │ │ type │ dir │ │
│ │ │ size │ 832 B │ │
│ │ │ modified │ 2 weeks ago │ │
│ │ ╰──────────┴─────────────╯ │
╰───────┴────────────────────────────╯
Rather than relying on the --numbered
flags of commands like each
, with the enumerate
command we take more modular and composable approach than hard-coding flags to our commands. (Note: The --numbered
flags have not been removed yet.)
Breaking changes to the web-related commands (Kazuki-Ya, VincenzoCarlino)
We decided to move some of the important command for interacting with HTTP under their own http
subcommands for better discoverability. The common fetch
command is now http get
.
Old name | New name beginning with 0.75 |
---|---|
fetch | http get |
post | http post |
to url | url build-query |
main
command exported from module defines top-level module command (kubouch)
Defining and exporting a main
command from a module allows creating a command with the same name as the module. Consider this example:
# command.nu
export def main [] { 'This is a command' }
export def subcommand [] { 'This is a subcommand' }
Then:
> use command.nu
> command
This is a command
> command subcommand
This is a subcommand
The same thing works overlay use
as well. Note that the main
command continues to work the same way as before when running a script:
> nu command.nu
This is a command
Combined with a recent bugfix, this feature allows for nicer way of defining known externals and custom completions.
Before:
# cargo.nu
export extern cargo [--version, --color: string@cargo-color-complete]
export extern `cargo check` [--quiet]
def cargo-color-complete [] {
[ auto, always, never ]
}
After:
# cargo.nu
export extern main [--version, --color: string@cargo-color-complete]
export extern check [--quiet]
def cargo-color-complete [] {
[ auto, always, never ]
}
It is also a stepping stone towards being able to handle directories which in turn is a stepping stone towards having proper Nushell packages.
Progress bar for save
command (Xoffio)
To watch the progress when saving large files you can now pass the --progress
flag to save
. It gives information about the throughput and an interactive progress bar if available.
Breaking changes
- Unicode escapes in strings now use and extended format
\u{X...}
, any scripts using the old syntax\uXXXX
will have to be updated. See also #7883. - The
to url
command has been renamed and moved tourl build-query
as this better reflects is role as a nushell specificurl
command compared to a conversion. (#7702) fetch
has been renamed tohttp get
(#7796)post
has been renamed tohttp post
(#7796)- Quotes are trimmed when escaping to
cmd.exe
(#7740) parse -r
now uses zero-indexed rows and uncapitalized columns (#7897)last
,skip
,drop
,take until
,take while
,skip until
,skip while
,where
,reverse
,shuffle
,append
,prepend
andsort-by
raise error when given non-lists (#7623)to csv
andto tsv
now throw error on unsupported inputs (7850)
Full changelog
Nushell
- kubouch created Remove deprecated
where -b
parameter, and Fix panic when assigning value to $env, and Fix wrong VarId of $in variable, and Fix command name lookup for known externals, and Allow main command to define top-level module command, and Add const support for all overlay commands - fdncred created update type check so that ++ with lists works better, and with the release of rust 1.67, let's bump to 1.66.1, and add decimal to SyntaxShape, and add some startup performance metrics, and print nushell startup time, and fix signature display in help commands, and update sqlparser dependency, and update semver dep, and Add cursor shape configuration for each edit mode, and update base64 implementation to newer crate, and update release-pkg comments for manual runs
- sholderbach created Pin
reedline
to new0.15
for release, and Apply more recent/nightly clippy lints, and Bumptrash
to3.0.1
, and Use variable names directly in the format strings, and Remove unusednu-test-support
innu-table
, and Update reedline for pre-release testing, and Version bump for0.75
release, and Bump to0.74.1
development version - dependabot[bot] created Bump windows from 0.43.0 to 0.44.0, and Bump serial_test from 0.10.0 to 1.0.0, and Bump roxmltree from 0.16.0 to 0.17.0, and Bump typetag from 0.1.8 to 0.2.5, and Bump chrono-tz from 0.6.3 to 0.8.1, and Bump actions-rust-lang/setup-rust-toolchain from 1.3.4 to 1.3.5, and Bump sysinfo from 0.26.4 to 0.27.7, and Bump miette from 5.3.0 to 5.5.0, and Bump shadow-rs from 0.16.3 to 0.20.0, and Bump rayon from 1.5.3 to 1.6.1, and Bump scraper from 0.13.0 to 0.14.0, and Bump regex from 1.6.0 to 1.7.1, and Bump git2 from 0.16.0 to 0.16.1, and Bump libgit2-sys from 0.14.1+1.5.0 to 0.14.2+1.5.1, and Bump bumpalo from 3.11.0 to 3.12.0, and Bump actions/stale from 3 to 6, and Bump serial_test from 0.8.0 to 0.10.0, and Bump quick-xml from 0.25.0 to 0.27.1, and Bump dialoguer from 0.9.0 to 0.10.3, and Bump uuid from 1.1.2 to 1.2.2, and Bump once_cell from 1.16.0 to 1.17.0, and Bump git2 from 0.15.0 to 0.16.0
- sophiajt created Use clippy-recommended simplification, and Add 'enumerate' command for enumeration
- merelymyself created make
parse -r
columns return 0-indexed uncapitalised, and letfind
take linebreaks into account inValue::String
, and convert SyntaxShape::Table into the corresponding Type - WindSoilder created make help commands search term don't generate $nothing, and refactor: use
input_handler::operate
in ansi_strip command, and mentiondo
incomplete
command's doc, and improve doc about flatten, and Let redirection keep exit code, and Fix multi-line redirection inside a block, and dependency update: update polar to 0.26.1 - Hofer-Julian created Add Github Actions workflow to check for typos, and Extract
gather_commandline_args
, and Reduce again the number of match calls, and Reduce number ofmatch
calls, and Extract manualPWD
extraction with methodcurrent_work_dir
, and Clean upnu-cli/src/eval_file.rs
, and Move all functions of main.rs into modules, and Cleanup ofsrc/main.rs
- bobhy created Support extended unicode escapes in strings: "\u{10fff}"
- rgwood created Name threads, and Remove 🆖 comments, and Clean up
cd.rs
, and Re-enable some good tests, remove some bad tests, and Fix the build after #7204, and Trim quotes when shelling out to cmd.exe, and Combine benchmarks to speed upcargo bench
build times - zhiburt created nu-commands/table (
table -e
) Recognize limited space better, and nu-table: Wrap last column intable -e
- SUPERCILEX created Fix
do
swallowing all output when ignoring errors - NotLebedev created To csv fix, and Ansi link
- Dorumin created Expose filtering by file type in glob
- michel-slm created [nu-test-support] Gate system locale tests
- VincenzoCarlino created Feat/7725 url join
- zoechi created Fix typos
- webbedspace created Do not list deprecated subcommands in
help <cmd>
, andbenchmark
now pipes input into the closure, andstr length
,str substring
,str index-of
,split words
andsplit chars
now use graphemes instead of UTF-8 bytes, and Disallowencode
's silent conversion to HTML entities (and add-i
/--ignore-errors
flag to re-allow it) - Kazuki-Ya created
fetch
->http get
andpost
->http post
- zschaffer created add magenta to ansi command as synonym for purple
- 1Kinoti created add dedicated
const in pipeline
,const builtin var
errors, and Allow underscores in integers and floats - Xoffio created Fixes Issue 7648 which crashes nushell and happens when an alias name is shorter than the alias command and the alias command is an external command., and Add test for fix of issue #7754
- DaRacci created Check all user groups.
- hustcer created fix some typos, and Fix generated doc for
explore
commands - afetisov created Fix typos and use more idiomatic assertions
- nanoqsh created Detailed message during core dumped
- murex971 created Add search terms in random and expression categories
Extension
- Hofer-Julian created Add another directory where nu might be installed
- fdncred created get ready for new 1.0 release
- glcraft created New syntax highlight
Documentation
- Hofer-Julian created Reflect the separation of block and closure, and Add separate page for setting Nu as default shell, and Add Github Actions workflow to check typos
- bobhy created Document \u{x...} unicode escapes, and document 7883 for release notes
- max-nextcloud created Update rust version requirement in installation
- WindSoilder created update doc about stdout and stderr
- webbedspace created Add my changes
- amtoine created link to default config file in the "explore" page, and remove a broken link in "Introducing nushell" # "Plugins", and fix a typo on "language", was spelled "langauge"
- rgwood created Disable prefetch setting
- waldyrious created Add two style tweaks to improve tables in code blocks
- hustcer created Refresh commands docs for nu v0.74
- hbt created fix deprecated cmd
Nu_Scripts
- Neur1n created nu_conda: Another Conda module with Better Performance
- fdncred created small tweaks to get panache working again, and fix oh-my.nu script after
do
changes in nushell, and fix ohmy.nu path handling on windows, and add timed_weather that checks the weather at timed intervals, and fixed a type-o in the weather script, and fix some bugs when on slash - Hofer-Julian created Fix scoop completions, and git-completions: Stop checking
--force-with-lease
, and conda: Check if environment exists before activating, and Explain how to create an alias for conda activate without a prompt - schrieveslaach created Fix git checkout/switch completions, and Improve git checkout/switch completions, and Add git cherry-pick completion
- 1Kinoti created add todo script
- amtoine created FIX: export the
git cherry-pick
completion - zoechi created Change "list of values" to "list of records" with value and description, and Export command to make it use-able, and Add completions for Bitwarden CLI client
- fj0r created K8s, and ssh kubernetes docker git just nvim
- fitzypop created add git_branch_cleanup.nu script and readme
- bobhy created prompt/full-line.nu -- full width prompt
- stormasm created add a Readme to the make_release directory
- kubouch created Add initial dependency resolver for nu release
- TornaxO7 created adding git aliases
- DrakeTDL created feat(custom-completions): add reflector completions
- ldsands created Add files needed for Poetry custom-completions
reedline
- sholderbach created Remove unstable rustdoc lint, and Bump version for
0.15
release - dgkf created Allow configuration of multiline prompt color