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}"
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.
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.
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.
- New enumerate command (JT)
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.
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 commmand for interacting with HTTP
under their own http subcommands for better discoverability. The common
fetch command is now http get.
- main command exported from module defines top-level module command (kubouch)
Defining and exporting a maincommand from a module allows creating a command
with the same name as the module.
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.
Combined with a recent bugfix, this feature allows for nicer way of defining
known externals and custom completions.
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 to url build-query as this
better reflects is role as a nushell specific url command compared to a
conversion. (#7702)
- fetch has been renamed to http get (#7796)
- post has been renamed to http 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 and sort-by raise error when given
non-lists (#7623)
- to csv and to tsv now throw error on unsupported inputs (7850)
New features with AN-2023-01-12:
UPDATING:
- Solaris 11.4: man pages are now installed according to BSD
conventions. Users may need to manually remove the following
old man pages on update: streamarchive.4, makefiles.4,
makerules.4, changeset.4, sccschangeset.4, sccsfile.4,
and star.4.
NEW FEATURES:
- libxtermcap/termcap: update to latest FreeBSD commit
- libxtermcap/termcap.url: remove file containing outdated
information about where to obtain a termcap file from.
- RULES/os-sunos5.def: man pages will now be installed into
BSD-style sections on Solaris >=11.4 and descendents.
- RULES: add symlink for arm64 OpenBSD
- Bourne Shell: Fix bug where set -o notify or set -b would cause
the shell to exit when ^C was pressed.
Submitted by Nico Sonack.
New features with AN-2023-01-12:
UPDATING:
- Solaris 11.4: man pages are now installed according to BSD
conventions. Users may need to manually remove the following
old man pages on update: streamarchive.4, makefiles.4,
makerules.4, changeset.4, sccschangeset.4, sccsfile.4,
and star.4.
NEW FEATURES:
- libxtermcap/termcap: update to latest FreeBSD commit
- libxtermcap/termcap.url: remove file containing outdated
information about where to obtain a termcap file from.
- RULES/os-sunos5.def: man pages will now be installed into
BSD-style sections on Solaris >=11.4 and descendents.
- RULES: add symlink for arm64 OpenBSD
- Bourne Shell: Fix bug where set -o notify or set -b would cause
the shell to exit when ^C was pressed.
Submitted by Nico Sonack.
0.74.0
Themes of this release / New features
- Known externals commands and exec now have "fall-through" signatures
(merelymyself, WindSoilder, kubouch). A common pitfall in Nushell when
defining custom signatures using extern used to be that unrecognized
arguments passed to the command would throw an error. Now, arguments are
still checked against the extern signature but those that are not recognized
are simply ignored.
exec uses similar style which fixes errors with tools like ssh and gdb that
internally invoke exec.
- help is now more helpful (kubouch). For a long time, Nushell had the option
to provide custom help messages for commands via comments.
In this release, we allow user-defined help messages with aliases and
modules. This goes hand-in-hand with a handful of new help subcommands to
explore these help messages. The help messages now also treat the first line
followed by an empty line as a "brief" description displayed in summary
tables generated by help commands, $nu.scope.aliases, etc. The full
description is available when querying a particular command/alias/module
(e.g., help spam). This brief vs. full separation was already present for
built-in commands, like path, but now it is applied also to all user-defined
help messages. The current batch of improvements can still be taken further.
For example, custom help messages could possibly be defined also for
variables and environment variables (via comments adjacent to let and
let-env). We could also further improve the presentation of existing help
xxx commands.
- nitial support for parse-time constants (kubouch). This is a
proof-of-concept that we plan to expand in the future. Tip: We also addedd a
new book section with an in-depth explanation of Nushell's parsing and
evaluation, hopefully clearing up some confusion about things like
"Why can't I source a dynamic path?". It also touches on the concept of
parse-time constants. A new const keyword is added to Nushell to define
"parse-time" constants. Constants defined with const behave the same as
variables defined with let, but in addition, they are usable in some
contexts that require values known at parse-time. Currently, this applies
to files or names passed to use, overlay use, source, and source-env.
Only a limited subset of values is allowed to be a constant. In general,
"simple" values, like strings or integers, and their collections (lists,
records) are allowed but values requiring some evaluation (string
interpolation, subexpressions, environment variables) are not allowed.
The current selection is not set in stone, however, and might change in
the future.
Some future direction we can take this:
- Move parts of $nu to be constant to allow things like source
$nu.config-path
- Allow modules to have constants (module spam { const CONTENTS =
[ 'eggs', 'bacon', 'sausage', 'spam' ] })
- Some limited form of parse-time evaluation to allow static control flow
In general, we want to be very conservative with parse-time constants and
evaluation because it can be easy to introduce awkward side-effects and
performance pitfalls. We plan to extend this only where it brings some
tangible benefit to Nushell's user experience.
- New url encode command to percent-encode URLs (MehulG). To encode text that
is used as a path component in a URL we now provide url encode. By default
it preserves the structure of a URL and only replaces invalid characters.
With --all the whole string gets encoded.
- values command to programmatically interact with records (webbedspace).
This is a complement to columns, designed to allow the values of a record
to be easily filtered and iterated over using the standard list tools like
each and where. The name values is derived from similar functions in Ruby,
Python and JavaScript. It can also operate on tables to convert them to
lists-of-lists.
- get, select, cell path access on tables will now error when encountering
a hole (kubouch, webbedspace). Formerly, this would produce ['bar', null] -
converting the table hole into a null. Now, however, they will produce an
error. The original null-conversion behaviour can, as usual, be opted into
using the -i flag for get and select: [{foo: 'bar'}, {}] | get -i foo
produces ['bar', null]. (There are also plans for a future version of
Nushell to expand the cell path syntax to allow certain cell names to be
"nullable" - converted to null if they don't exist.).
- Behavior of -i/--ignore-errors flag for get and select when the entire
column is absent has changed. Formerly, if select -i or get -i couldn't find
any value for the given column, it would produce a single null. This has
been changed so that it now produces a table (or, in the case of get, a
list) of all nulls. This change was made to make this flag work more
consistently with default and compact.
- Certain misused punctuation in def definitions are now errors (webbedspace).
The following misuses of punctuation in def definitions now produce errors:
- Placing a comma between a long flag and its short alternative (e.g. def
a [--foo, (-f)] {})
- Consecutive commas, like def a [foo,,bar] {}
- Consecutive colons, like def a [foo::int] {}
- Using ^ in command names, like def ^a [] {}
- $in now works in catch closures.
$in in catch closures now behaves identically to how it does in other
closures, like those given to each (it's equivalent to what would be the
first named argument).
try { 'x' | math abs } catch { print $in } behaves the same as try
{ 'x' | math abs } catch {|e| print $e }.
- MIME-types are supported in ls with an additional flag. (fdncred). To find
out what application your operating system associates with a particular
file, you can now use the --mime-type or -m flag on our ls command.
This simplifies filtering for particular files and can help you dispatch
files to particular programs. When opening files with Nushell directly,
open will still follow the same heuristics using file endings and the
built-in from ... command parsers.
- Regular expression queries are cached for performance (rgwood). The primary
motivation for this is to make regex and =~ operator uses in hooks and
color_config closures more performant.
- All built-in commands now declare their pipeline input and output types
(sholderbach). A few releases back commands internally got the capability
to declare not only the types of parameters but also pairs for the input
and output on the pipeline. With this release we finally declare those
input and output types for all core nushell commands. This can help you as
user to see what a command expects from the pipeline and might return. We
are exploring how nushell can leverage that for more useful diagnostics
and completions. In the future we may introduce syntax for user-defined
commands to declare their input and output types explicitly.
- Breaking changes
- get and select now error when encountering a hole
- the behaviour of -i on get and select has changed columns will now error
for data that is not a table or a record (#7593)
- The dataframe specific command fill-na has been renamed to fill-nan to
better represent its capabilities (#7565)
- The requirements for the names of a nu command and a command alias have
been tightened to avoid some problems (#7392)
- to toml will only produce output for records now as the output for tables
is ambiguous and may be invalid to parse (#7597)
- exec and known externals don't throw errors when unknowns parameters are
passed to them
- help command has been thoroughly refactored and includes several more
subcommands. help <word> now matches commands, aliases, and modules.
- command names in help commands and $nu.scope.commands are displayed
correctly if they were imported from a module with a prefix
- hide command no longer hides environment variables. Use hide-env instead.
(#7687)
- math eval has been removed in favour of the direct math commands and
expressions (see help operators as well) (#7284)
- last, skip, drop, take until, take while, skip until, skip while, where,
reverse, shuffle, and sort-by are now stricter about which types of data
they accept (#7623)
0.73.0
Themes of this release / New features
PLEASE NOTE: Boolean && and || have changed
- The boolean && is now and and the boolean || is now or. These were deprecated
in the 0.72 release and have now been removed. Existing scripts will need to
be updated to the new syntax to run in 0.73.
- Experimental interactive explore command (zhiburt). This release includes a
new experimental command called explore for viewing Nu data in an
interactive UI. Some things to try:
- pipe a large table to explore (ex: ls | explore) and use explore as a
fancy pager
- run explore, then type :try and press the Enter key to enter a mode where
you can run commands inside explore
explore is highly experimental and we expect it to change in the future.
Please report any issues you discover.
- New math commands (sholderbach). With this release we include a larger number
of math commands for real valued math such as trigonometric functions and
logarithms. The goal is to remove the math eval command that operates on
strings instead of proper nushell expressions.
- Changes to commands with predicates (kubouch). any, all, skip until,
skip while, take until, and take while now accept a closure instead of a row
condition. This makes them slightly more verbose but it is a part of an
effort to refactor our parser to allow defining concrete grammar rules for
the Nu language. Row condition is currently accepted only in the where
command which becomes a parser built-in command (like use or let).
- New filter command and simpler where (kubouch). We found the -b flag of
where quite confusing and decided to remove it in favor of a new filter
command. Both filter and where have similar functionality but where now only
accepts a row condition and filter accepts a closure. Why is it useful to
have two commands doing the same thing? Because with the filter command,
you can store the closure in a variable. On the other hand, where is more
concise ([{a: 1} {a: 2}] | where a > 1) but you can't store its condition in
a variable. The choice is yours!
- New command uniq-by (raccmonteiro). To complement uniq which can identify
unique or duplicated values in a collection or report the number of
occurrences for a particular entry, we now have uniq-by. It supports
filtering a table by entries appearing in a particular column.
- Mutable data structures can now have their inner values mutated using
= (webbedspace). If a variable has been defined as mutable using the
recently-added mut keyword, you can now deeply mutate its inner values
using =. This syntax enhancement was added primarily to make modifying
$env.config during a normal session much easier. Now, $env.config is
considered inherently mutable. You can change a single config value.
- More sophisticated coloring of data values using closures (webbedspace).
The color_config config record has new functionality: instead of specifying
a single color name for all values of a given type, you may now alternatively
provide a closure that dynamically computes a color for each individual
value. The closure takes, as input, a single value of the given type, and
must produce either a string value representing a color, or a
{ fg, bg, attr } record (the same as what color_config already accepts as a
color value). This feature can be used to provide important visual
distinctions between ranges of values in data.
This causes all filesize values to be colored using dark_gray if they equal
0b, cyan_bold if they are less than 1mb, and blue_bold otherwise. This means
that, in ls output, empty files can be more easily distinguished from
non-empty ones. This colors true in light_cyan, and false in light_gray.
This can be useful when browsing a large table of booleans. The themes in
the default config.nu file have been updated with further examples of these
closures.
In certain situations (most notably, during a single ls call that isn't
piped to anything else) Nushell will parallelize the execution of these
closures. As such, you cannot expect that they will run in the same order
as each value appears in the output data.
WARNING
Currently, closures are only supported for output values - they do not work
with color settings that begin with shape_, such as shape_literal. They also
do not work with the color configuration for the new explore command. Only
values inside of tables are highlighted using closures.
Breaking Changes
- split row command will retain an empty string if splitted string is empty.
(#7413)
- split list now properly removes the separator in all positions (#7355)
- The --show-created-paths flag has been replaced by --verbose from mkdir.
- fetch removes --output, --bin, --append flags, use fetch with save to save
fetched page to a file. (#7468)
- changes to how get works with deep cell paths (#7480)
- mkdir's -s/--show-created-paths has been renamed to -v/--verbose for better
consistency (#7462)
- && is now and and || is now or
- any, all, skip until, skip while, take until, take while now take only a
closure as an argument.
- where now takes only row condition argument, -b flag removed.
0.72.1
- This is the 0.72.1 release of Nushell. It is a hotfix release of 0.72.0 that
changes how the Ubuntu release binary is built so that it does not change
glibc versions.
0.72.0
Today, we're releasing version 0.72 of Nu. This release includes many new
features: mutability, looping, early returns, changes to the core commands,
and much more.
NOTE: as part of this release, we are no longer including additional features
in --features=extra. With 0.72, SQLite features have moved into the main
Nushell installation and dataframe functionality is now part of
--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
- Try/catch
Starting with 0.72, it's now much easier to run a command that might fail
and then handle the failure if it happens.
The catch part of the try/catch is optional. Without it, the try block will
run, and any error that occurs will be ignored.
- Auto-expanding data views
Expanded data view
With the new default config, we now also detect the terminal width and will
automatically expand the data view to include more information if it's
available.
This uses an improved expanding data view capability from 0.70.
- Redirection
This release also includes a new way of redirecting the stdout and/or stderr
of external commands. This gives easier access to the output streams than was
previously possible.
You can also create a stream built from the above, allowing one stream to empty
and then be followed by the other stream.
- Closures/blocks
We have now split closures and blocks into two separate value types. A closure
can have parameters, can close over variables outside of its scope, and can be
passed as a value.
You can also think of creating a custom command like def foo [] { ... } as
creating a closure.
A block is much simpler and is used as the bottom of commands like if and loops.
Blocks don't close over (or capture) variables, don't have parameters, and
can't be passed as a value. Blocks, however, do have one special trick...
- Mutation
Starting in this release, you can create local mutable variables. You can
create mutable variables using the mut keyword.
A mutable variable can only live and change in the closure in which it's
created. Blocks, however, have access to the mutable variables in the parent
closure. For example, mutating a variable inside of the block used in an if
call is valid.
- Loop/while
The 0.72 release also includes a few new looping commands: loop and while.
The loop command runs a block forever.
The while command will run its block as long as a condition is met:
- Break/continue
Loops can now also use the break and continue feature common in many programming
languages. break will break out of the current loop. And continue will continue
the loop at the next iteration.
- Return
The 0.72 release also includes the ability to return early from a closure or
command.
- Command refinement, simplification, and elimination
This release contains many breaking changes to Nu's built-in commands (sorry!).
As we move toward version 1.0 we want to ensure that Nu ships with a small
curated set of consistent, well-designed "standard library" commands.
This requires taking a hard look at existing commands, and in some cases
breaking changes are unavoidable. We expect that this effort will span a
few release cycles.
- Dataframes no longer included by default - smaller binaries
Nu's dataframe support is extensive, impressive, and very useful to users who
rely on it. However, it comes at a high cost in terms of compile time, binary
size, and complexity. Starting with version 0.72, dataframe commands are no
longer included in the release binaries published on GitHub or the default
binaries published via package managers (like Homebrew, winget, Scoop).
As a result of this change, the main Nu executable is now about 50% smaller.
To continue using dataframe commands, you can build Nu from source using the
dataframe Cargo feature. For example, to install using Cargo: cargo install
nu --features=dataframe.
- Allow reloading overlay definitions (kubouch)
A common pattern in using overlays is shadowing an existing environment
variable, such as PROMPT_COMMAND. However, overlay use would keep loading the
value from the first activation.
Calling overlay use prompt for the first time changes the prompt to the current
time, however, subsequent calls to overlay use won't change the time. That's
because overlays, once activated, store their state so they can be hidden and
restored at later time. To force-reload the environment, we added a new --reload
flag: Calling overlay use --reload prompt repeatedly now updates the prompt with
the current time each time.
- virtualenv activation changes (kubouch)
Since the verion 20.17.0 of virtualenv, the new way to activate an environment
is to call overlay use activate.nu instead of the source activate.nu. This
change is in line with gradual deprecation of source and moving us towards
using modules as overlays in more cases. Please, check the activation script
itself for more details.
- Breaking changes
- As mentioned above, dataframe support has been removed from the default
Nu binaries.
- Nu's SQLite DSL commands have been removed. open foo.db and open
foo.db | query db "SELECT * ..." still work, but the commands which
mapped 1-to-1 with SQL clauses (ex: open foo.db | into db | select * |
from table some_table | order-by some_column) have been removed.
These commands were an interesting experiment but they didn't work out,
and we're removing them to simplify database access in Nu.
- The is_plugin, is_custom, and is_keyword columns in help commands have
been replaced with a single command_type column.
- date format now returns an error if not given an input. Previously it
would default to the current time.
- first and last will now return an error if given a negative index.
Previously the behavior was undefined and may have returned entries
due to an underflow.
- The --predicate flag has been removed from find. where can be used in
all situations where find --predicate was previously used.
- sort-by now requires a column name to sort by. To sort lists without
specifying a column name, sort can be used.
- seq, seq char, and seq date no longer have --separator and --terminator
flags (#7045, #7054, #7096). This helps ensure that the return type for
those commands is consistent, and str join can be used to accomplish the
same effect.
- The build-string command has been removed. To concatenate strings, use
the + operator, string interpolation, or str join.
- wrap now expands ranges. It works the same as with lists or seq.
- url parse url scheme, url host, url path, and url query commands have
been removed. We added the command url parse.
This new command returns a Record with scheme, username, password, host,
path, query, params (as a Record) and fragment.
- sort, sort-by, str contains and find have had their --insensitive flags
renamed to --ignore-case. --ignore-case is used by uniq, as well as
popular external commands like less, grep and wget, so it could be
considered a standard flag name.
- New boolean operator xor - Planned operator simplification
To complement our logical boolean operators and/&& and or/|| we added boolean
xor. This is consistent with bit-and, bit-xor, and bit-or.
We are currently considering to deprecate the C-style symbols &&/|| in favor of
the spelled out and/or to increase consistency and provide more actionable
error messages when trying to use &&/|| in a similar fashion to bash.
- Config options have been grouped together
The structure of $env.config (and thus the record used with let-env config =
statements in config.nu and other places) has been reorganised. Various options
are now grouped into subrecords (similar to table_trim) and had their names
shortened. This allows config.nu files to be better structured, and thus easier
to edit and read, while also allowing future options to be added without making
the,
WARNING
Your existing config.nu options WILL still work in this version!! However,
you will get a warning message if you use the old versions of the options
(as you might already be aware). Support for these old options will be dropped
in a future Nushell update, so take care to convert your config.nu files when
you can.
The changes are:
- use_ls_colors and clickable_links have been moved to into an ls subrecord.
- rm_always_trash has been moved into the rm record. Further rm config
options to accompany it may appear in the future.
- cd_with_abbreviations has been moved into a cd record. Further cd config
options to accompany it may appear in the future.
- history_file_format, sync_history_on_enter and max_history_size have been
moved to a history subrecord.
- filesize_metric and filesize_format have been moved to a filesize
subrecord.
- case_sensitive_completions, quick_completions, partial_completions and
completion_algorithm have been moved into a completions subrecord.
- The completions subrecord also contains an external subrecord.
- enable_external_completion, max_external_completion_results, and
external_completer have been moved into the aforementioned subrecord.
- table_mode, table_index_mode and the table_trim subrecord have been
moved into a table subrecord.
To output your existing options in the above format (that could be pasted into
your config.nu file before you delete the old options), run this code in your
copy of Nushell:
- Minimum Rust version has bumped to 1.65
Due to some breakage in dependencies, we've gone ahead and bumped the required
version of Rust to 1.65, which addresses the issue. Apologies to anyone who is
inconvenienced by the bump. We anticipate returning to the Rust-1 versions in
the future.
Fix build on older OS versions that lack _SC_REALTIME_SIGNALS,
_SC_TIMER_MAX, _SC_CPUTIME, _SC_THREAD_CPUTIME, SC_DELAYTIMER_MAX and
_SC_SIGQUEUE_MAX such as NetBSD 7
fish 3.6.0 (released January 7, 2023)
=====================================
Notable improvements and fixes
------------------------------
- By default, :kbd:`Control-R` now opens the command history in the pager (:issue:`602`). This is fully searchable and syntax-highlighted, as an alternative to the incremental search seen in other shells. The new special input function ``history-pager`` has been added for custom bindings.
- Abbrevations are more flexible (:issue:`9313`, :issue:`5003`, :issue:`2287`):
- They may optionally replace tokens anywhere on the command line, instead of only commands
- Matching tokens may be described using a regular expression instead of a literal word
- The replacement text may be produced by a fish function, instead of a literal word
- They may position the cursor anywhere in the expansion, instead of at the end
For example::
function multicd
echo cd (string repeat -n (math (string length -- $argv[1]) - 1) ../)
end
abbr --add dotdot --regex '^\.\.+$' --function multicd
This expands ``..`` to ``cd ../``, ``...`` to ``cd ../../`` and ``....`` to ``cd ../../../`` and so on.
Or::
function last_history_item; echo $history[1]; end
abbr -a !! --position anywhere --function last_history_item
which expands ``!!`` to the last history item, anywhere on the command line, mimicking other shells' history expansion.
See :ref:`the documentation <cmd-abbr>` for more.
- ``path`` gained a new ``mtime`` subcommand to print the modification time stamp for files. For example, this can be used to handle cache file ages (:issue:`9057`)::
> touch foo
> sleep 10
> path mtime --relative foo
10
- ``string`` gained a new ``shorten`` subcommand to shorten strings to a given visible width (:issue:`9156`)::
> string shorten --max 10 "Hello this is a long string"
Hello thi…
- ``test`` (aka ``[``) gained ``-ot`` (older than) and ``-nt`` (newer than) operators to compare file modification times, and ``-ef`` to compare whether the arguments are the same file (:issue:`3589`).
- fish will now mark the extent of many errors with a squiggly line, instead of just a caret (``^``) at the beginning (:issue:`9130`). For example::
checks/set.fish (line 471): for: a,b: invalid variable name. See `help identifiers`
for a,b in y 1 z 3
^~^
- A new function, ``fish_delta``, shows changes that have been made in fish's configuration from the defaults (:issue:`9255`).
- ``set --erase`` can now be used with multiple scopes at once, like ``set -efglU foo`` (:issue:`7711`, :issue:`9280`).
- ``status`` gained a new subcommand, ``current-commandline``, which retrieves the entirety of the currently-executing command line when called from a function during execution. This allows easier job introspection (:issue:`8905`, :issue:`9296`).
Deprecations and removed features
---------------------------------
- The ``\x`` and ``\X`` escape syntax is now equivalent. ``\xAB`` previously behaved the same as ``\XAB``, except that it would error if the value "AB" was larger than "7f" (127 in decimal, the highest ASCII value) (:issue:`9247`, :issue:`9245`, :issue:`1352`).
- The ``fish_git_prompt`` will now only turn on features if the appropriate variable has been set to a true value (of "1", "yes" or "true") instead of just checking if it is defined. This allows specifically turning features *off* without having to erase variables, such as via universal variables. If you have defined a variable to a different value and expect it to count as true, you need to change it (:issue:`9274`).
For example, ``set -g __fish_git_prompt_show_informative_status 0`` previously would have enabled informative status (because any value would have done so), but now it turns it off.
- Abbreviations are no longer stored in universal variables. Existing universal abbreviations are still imported, but new abbreviations should be added to ``config.fish``.
- The short option ``-r`` for abbreviations has changed from ``rename`` to ``regex``, for consistency with ``string``.
Scripting improvements
----------------------
- ``argparse`` can now be used without option specifications, to allow using ``--min-args``, ``--max-args`` or for commands that take no options (but might in future) (:issue:`9006`)::
function my_copy
argparse --min-args 2 -- $argv
or return
cp $argv
end
- ``set --show`` now shows when a variable was inherited from fish's parent process, which should help with debugging (:issue:`9029`)::
> set --show XDG_DATA_DIRS
$XDG_DATA_DIRS: set in global scope, exported, a path variable with 4 elements
$XDG_DATA_DIRS[1]: |/home/alfa/.local/share/flatpak/exports/share|
$XDG_DATA_DIRS[2]: |/var/lib/flatpak/exports/share|
$XDG_DATA_DIRS[3]: |/usr/local/share|
$XDG_DATA_DIRS[4]: |/usr/share|
$XDG_DATA_DIRS: originally inherited as |/home/alfa/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/|
- The read limit is now restored to the default when :envvar:`fish_read_limit` is unset (:issue:`9129`).
- ``math`` produces an error for division-by-zero, as well as augmenting some errors with their extent (:issue:`9190`). This changes behavior in some limited cases, such as::
math min 1 / 0, 5
which would previously print "5" (because in floating point division "1 / 0" yields infinite, and 5 is smaller than infinite) but will now return an error.
- ``fish_clipboard_copy`` and ``fish_clipboard_paste`` can now be used in pipes (:issue:`9271`)::
git rev-list 3.5.1 | fish_clipboard_copy
fish_clipboard_paste | string join + | math
- ``status fish-path`` returns a fully-normalised path, particularly noticeable on NetBSD (:issue:`9085`).
Interactive improvements
------------------------
- If the terminal definition for :envvar:`TERM` can't be found, fish now tries using the "xterm-256color" and "xterm" definitions before "ansi" and "dumb". As the majority of terminal emulators in common use are now more or less xterm-compatible (often even explicitly claiming the xterm-256color entry), this should often result in a fully or almost fully usable terminal (:issue:`9026`).
- A new variable, :envvar:`fish_cursor_selection_mode`, can be used to configure whether the command line selection includes the character under the cursor (``inclusive``) or not (``exclusive``). The new default is ``exclusive``; use ``set fish_cursor_selection_mode inclusive`` to get the previous behavior back (:issue:`7762`).
- fish's completion pager now fills half the terminal on first tab press instead of only 4 rows, which should make results visible more often and save key presses, without constantly snapping fish to the top of the terminal (:issue:`9105`, :issue:`2698`).
- The ``complete-and-search`` binding, used with :kbd:`Shift-Tab` by default, selects the first item in the results immediately (:issue:`9080`).
- ``bind`` output is now syntax-highlighted when used interacively.
- :kbd:`Alt-H` (the default ``__fish_man_page`` binding) does a better job of showing the manual page of the command under cursor (:issue:`9020`).
- If :envvar:`fish_color_valid_path` contains an actual color instead of just modifiers, those will be used for valid paths even if the underlying color isn't "normal" (:issue:`9159`).
- The key combination for the QUIT terminal sequence, often :kbd:`Control-Backslash` (``\x1c``), can now be sused as a binding (:issue:`9234`).
- fish's vi mode uses normal xterm-style sequences to signal cursor change, instead of using the iTerm's proprietary escape sequences. This allows for a blinking cursor and makes it work in complicated scenarios with nested terminals. (:issue:`3741`, :issue:`9172`)
- When running fish on a remote system (such as inside SSH or a container), :kbd:`Control-X` now copies to the local client system's clipboard if the terminal supports OSC 52.
- ``commandline`` gained two new options, ``--selection-start`` and ``--selection-end``, to set the start/end of the current selection (:issue:`9197`, :issue:`9215`).
- fish's builtins now handle keyboard interrupts (:kbd:`Control-C`) correctly (:issue:`9266`).
Completions
^^^^^^^^^^^
- Added completions for:
- ``ark``
- ``asciinema`` (:issue:`9257`)
- ``clojure`` (:issue:`9272`)
- ``csh``
- ``direnv`` (:issue:`9268`)
- ``dive`` (:issue:`9082`)
- ``dolphin``
- ``dua`` (:issue:`9277`)
- ``efivar`` (:issue:`9318`)
- ``eg``
- ``es`` (:issue:`9388`)
- ``firefox-developer-edition`` and ``firefox`` (:issue:`9090`)
- ``fortune`` (:issue:`9177`)
- ``kb``
- ``kind`` (:issue:`9110`)
- ``konsole``
- ``ksh``
- ``loadkeys`` (:issue:`9312`)
- ``okular``
- ``op`` (:issue:`9300`)
- ``ouch`` (:issue:`9405`)
- ``pix``
- ``readelf`` (:issue:`8746`, :issue:`9386`)
- ``qshell``
- ``rc``
- ``sad`` (:issue:`9145`)
- ``tcsh``
- ``toot``
- ``tox`` (:issue:`9078`)
- ``wish``
- ``xed``
- ``xonsh`` (:issue:`9389`)
- ``xplayer``
- ``xreader``
- ``xviewer``
- ``yash`` (:issue:`9391`)
- ``zig`` (:issue:`9083`)
- Improvements to many completions, including making ``cd`` completion much faster (:issue:`9220`).
- Completion of tilde (``~``) works properly even when the file name contains an escaped character (:issue:`9073`).
- fish no longer loads completions if the command is used via a relative path and is not in :envvar:`PATH` (:issue:`9133`).
- fish no longer completes inside of comments (:issue:`9320`).
Improved terminal support
^^^^^^^^^^^^^^^^^^^^^^^^^
- Opening ``help`` on WSL now uses PowerShell to open the browser if available, removing some awkward UNC path errors (:issue:`9119`).
Other improvements
------------------
- The Web-based configuration tool now works on systems with IPv6 disabled (:issue:`3857`).
- Aliases can ignore arguments by ending them with ``#`` (:issue:`9199`).
- ``string`` is now faster when reading large strings from stdin (:issue:`9139`).
- ``string repeat`` uses less memory and is faster. (:issue:`9124`)
- Builtins are much faster when writing to a pipe or file. (:issue:`9229`).
- Performance improvements to highlighting (:issue:`9180`) should make using fish more pleasant on slow systems.
- On 32-bit systems, globs like ``*`` will no longer fail to return some files, as large file support has been enabled.
Fixed bugs
----------
- The history search text for a token search is now highlighted correctly if the line contains multiple instances of that text (:issue:`9066`).
- ``process-exit`` and ``job-exit`` events are now generated for all background jobs, including those launched from event handlers (:issue:`9096`).
- A crash when completing a token that contained both a potential glob and a quoted variable expansion was fixed (:issue:`9137`).
- ``prompt_pwd`` no longer accidentally overwrites a global or universal ``$fish_prompt_pwd_full_dirs`` when called with the ``-d`` or ``--full-length-dirs`` option (:issue:`9123`).
- A bug which caused fish to freeze or exit after running a command which does not preserve the foreground process group was fixed (:issue:`9181`).
- The "Disco" sample prompt no longer prints an error in some working directories (:issue:`9164`). If you saved this prompt, you should run ``fish_config prompt save disco`` again.
- fish launches external commands via the given path again, rather than always using an absolute path. This behaviour was inadvertently changed in 3.5.0 and is visible, for example, when launching a bash script which checks ``$0`` (:issue:`9143`).
- ``printf`` no longer tries to interpret the first argument as an option (:issue:`9132`).
- Interactive ``read`` in scripts will now have the correct keybindings again (:issue:`9227`).
- A possible stack overflow when recursively evaluating substitutions has been fixed (:issue:`9302`).
- A crash with relative $CDPATH has been fixed (:issue:`9407`).
- ``printf`` now properly fills extra ``%d`` specifiers with 0 even on macOS and BSD (:issue:`9321`).
- ``fish_key_reader`` now correctly exits when receiving a SIGHUP (like after closing the terminal) (:issue:`9309`).
- ``fish_config theme save`` now works as documented instead of erroring out (:issue:`9088`, :issue:`9273`).
- fish no longer triggers prompts to install command line tools when first run on macOS (:issue:`9343`).
- ``fish_git_prompt`` now quietly fails on macOS if the xcrun cache is not yet populated (:issue:`6625`), working around a potential hang.
For distributors
----------------
- The vendored PCRE2 sources have been removed. It is recommended to declare PCRE2 as a dependency when packaging fish. If the CMake variable FISH_USE_SYSTEM_PCRE2 is false, fish will now download and build PCRE2 from the official repo (:issue:`8355`, :issue:`8363`). Note this variable defaults to true if PCRE2 is found installed on the system.
- Plugins from Git repositories
- Branch / tag / commit support
- Submodule support
- First class support for GitHub repositories
- First class support for Gists
- Arbitrary remote scripts or binary plugins
- Local plugins
- Inline plugins
ChangeLog:
v0.9.0 - 2022-12-12
Added
SC2316: Warn about 'local readonly foo' and similar (thanks, patrickxia!)
SC2317: Warn about unreachable commands
SC2318: Warn about backreferences in 'declare x=1 y=$x'
SC2319/SC2320: Warn when $? refers to echo/printf/[ ]/[[ ]]/test
SC2321: Suggest removing ((..))inarray[((idx))]=val
SC2322: Suggest collapsing double parentheses in arithmetic contexts
SC2323: Suggest removing wrapping parentheses in a[(x+1)]=val
Fixed
SC2086: Now uses DFA to make more accurate predictions about values
SC2086: No longer warns about values declared as integer with declare -i
Changed
ShellCheck now has a Data Flow Analysis engine to make smarter decisions
based on control flow rather than just syntax. Existing checks will
gradually start using it, which may cause them to trigger differently
(but more accurately).
Values in directives/shellcheckrc can now be quoted with '' or ""
Instead of patching in an increasingly long list of OSes to avoid
redefining <stdlib.h> functions on, just use #if 0. Should fix the
Solaris build.
While here, don't hardcode the traditional wait status encoding; it's
no longer necessary to work around union wait and baking it in
violates portability rules.
PKGREVISION -> 5
The project was renamed from osh to etsh in 2016.
The author himself was added as MAINTAINER for shells/osh as per request
in 2008.
However, it's reasonable to assume that they lost interest in the
package in the meantime.
In any case, we have shells/etsh now, making this an obsolete duplicate.
Note that we are specifically using -r1.21 as newer versions do not build.
This improves performance on systems that use mksh as the bootstrap shell, due
to widespread use of printf in the pkgsrc infrastructure that previously had
to fork /usr/bin/printf.
Tested on macOS and SmartOS. Bump PKGREVISION.
Prevent the `mkconfig' script from overwiriting CC and INSTALL
environment on SunOS. The script assumed OpenIndiana to be the
target SunOS platform, but this is isn't necessarily the case.
Package tested on Solaris 11.4 with Solaris Studio 12.6.
This addresses an issue on SunOS systems where the default compiler
path might be non-existent, and likely prevents further breakages due
to hard-coded assumptions.
Es is an extensible shell. The language was derived from the Plan 9
shell, rc, and was influenced by functional programming languages, such as
Scheme, and the Tcl embeddable programming language. This implementation is
derived from Byron Rakitzis's public domain implementation of rc, and was
written by Paul Haahr and Byron Rakitzis.
recent releases patches, which fix:
Patch-13:
Bash can leak memory when referencing a noneexistent
associative array element.
Patch-14:
Bash defers processing additional terminating signals when
running the EXIT trap while exiting due to a terminating signal.
This patch allows the new terminating signal to kill the shell
immediately.
Patch-15:
There are several cases where bash is too aggressive when
optimizing out forks in subshells. For example, `eval' and
traps should never be optimized.
Changes since 6.24.02:
11. V6.24.03 - 20221203
10. Fix set/@ test when diff is from busybox (Luke Mewburn)
9. Handle \c in echo properly instead of printing garbage past the
end of the string.
8. Add a configure check for a working sbrk() (Luke Mewburn)
These 3 new patches fix the following bugs:
Patch 10:
Bash-5.2 checkr the first 128 characters of an executable file
that execve() refuses to execute to see whether it's a binary
file before trying to execute it as a shell script. This defeats
some previously-supported use cases like "self-executing" jar
files or "self-uncompressing" scripts.
Patch 11:
Using timeouts and readline editing with the `read' builtin
(read -e -t) can leave the readline timeout enabled, potentially
resulting in an erroneous timeout on the next call.
Patch 12:
When running in bash compatibility mode, nested command
substitutions can leave the `extglob' option enabled.
Changes since 6.24.01:
7. V6.24.02 - 20221124
6. Complete mdoc-based manual page (Luke Mewburn)
5. Fix rechist() check for NULL filename (broke when arg was renamed).
> cd
> rm .history
> unset savehist
> history -S /tmp/s
> exit
A ~/.history has been written when it should not have been.
4. Make OpenBSD use SHORT_STRINGS and fix non-SHORT_STRINGS compilation.
- New ++ operator (merelymyself)
In this release, you can now use the ++ operator to append lists together.
For example, you can combine two lists into a new lists made up of the both
lists.
Note: Currently, this operator cannot be used to join two tables. This
functionality is still being worked on and will likely be present in the
next version.
- Improved consistency across commands and types
Nushell continues improve quality of the language and shell with a set of
consistency improvements in this release. These include:
- More iterating filter commands now support the $in variable consistently
(webbedspace)
- Lists now support upsert (fdncred)
- merge can now also operate on records (webbedspace)
- str substring can take ranges (rgwood)
- from and to now show help info (rgwood)
- Right prompts can now be on the last line (nibon7)
Previously the right prompt appeared only on the same line where the user
input started. Now you can choose to place the right prompt part on the last
line of user input. This feature is not enabled by default, you can enable
it using the config nu command to modify the config.nu file, just set
render_right_prompt_on_last_line to true.
- Configuring the default value viewer via display_output hook (perbothner)
You're now able to configure a new hook, called display_output, which will
become the default way that you view data.
Using this, you can for example, use table --expand to always see fully
expanded tables.
If your terminal supports it, you can this to render a more full-featured
output. For example, DomTerm could be used by setting the display_output
hook to: to html --partial --no-color | domterm hcat, sending html to the
terminal to be rendered when displaying values.
- Updated PR Review Process
Recently, we have been fortunate to see a rise in submitted pull requests
and we are super grateful for this growing desire to improve Nushell.
Unfortunately, in some cases, a well-intended PR does not match the
direction Nushell is going, forcing us to close it which leads to wasted
time and effort. To help focus PRs in the future, we kindly ask potential
contributors to first reach out to us before making a substantial change to
Nushell, especially if the change will affect user experience. We updated
our contributing guide as well as the PR template to reflect this policy.
- Completion actions now more familiar (dandavison)
We've also recently improved how completions work in Nushell to feel closer
to how other shells work. Specifically:
- Completion goes "as far as possible". So, the entire word if there's a
unique completion, or else up to the shared prefix of possible
completions.
- Removes the quick completion behavior whereby a word was completed
automatically as soon as the input came to have a unique completion.
- Tab now completes instead of selecting the next menu item (this can be
configured)
- Breaking changes
- New --force (-f) flag for the mv command. This change alters mv default
behavior. By default overwriting existing files is now prevented (You can
use alias mv = mv -f in you config to get the old defaults back). (#6904)
- The column name for the command name in $nu.scope.commands has been
changed from command to name. Thus, $nu.scope.commands | where name =~
zip would give you specific command info. (#7007)
- The str distance command now directly returns an Int instead of a record
{"distance": <Int>} (#6963)
- The argument order of format filesize was made consistent with other
commands that accept a CellPath to specify fields that should be affected
by it. Now the string specifying the format is the first positional
argument and the cell path is specified in the following positional
argument(s). (#6879)
- The --perf flag for Nu was removed as part of an effort to simplify
diagnostics logging #6834
The patches fix the following bugs:
Patch 3:
Command substitutions need to preserve newlines instead of replacing
them with semicolons
Patch 4:
Bash needs to keep better track of nested brace expansions to
avoid problems with quoting and POSIX semantics.
Patch 5:
Null pattern substitution replacement strings can cause a crash
Patch 6:
In interactive shells, interrupting the shell while entering a command
substitution can inhibit alias expansion.
Patch 7:
Several problems with alias expansion inside command
substitutions when in POSIX mode
Patch 8:
Array subscript expansion can inappropriately quote brackets
if the expression contains < or >.
Patch 9:
Bash arithmetic expansion should allow `@' and `*' to be used
as associative array keys in expressions.
Yash, yet another shell, is a POSIX-compliant command line shell written
in C99 (ISO/IEC 9899:1999). Yash is intended to be the most POSIX -
compliant shell in the world while supporting features for daily
interactive and scripting use. Notable features are:
- Global aliases
- Arrays
- Socket redirection, pipeline redirection, and process redirection
- Brace expansion and extended globbing
- Fractional numbers in arithmetic expansion
- Prompt command and command-not-found handler
- Command line completion with predefined completion scripts for more
than 100 commands
- Command line prediction based on command history
By Paolo Vincenzo Olivo in wip
Main changes between 1.0.3 and 1.0.4:
- Fixed multiple scoping-related bugs in the += additive assignment
operator.
- A number of crashing bugs have been fixed.
- Various fixes for the Haiku operating system, notably 'ulimit -a'
now works.
- Fixed the expansion of out-of-range \n back references in the
string part of ${parameter//pattern/string}. For example:
v=AB; echo "${v/@(A)B/\0:\1:\2}"
now yields 'AB:A:' instead of 'AB:A:\2'.
- Fixed quoted '!', '^' and '-' within [bracket] expressions in
glob patterns; single or double quotes failed to disable their
operator behaviour.
- Fixed a bug introduced on 2021-04-04 that incorrectly allowed
'typeset' to turn off the readonly and export attributes on a
readonly variable.
- In the emacs line editor, the Ctrl+R reverse-search prompt is
now visually distinct from a literal control character ("^R: "
instead of "^R").
- In the vi line editor, fixed the behaviour of 'C', 'c$' and 'I'
to be consistent with standard vi(1) and with Bolsky & Korn
(1995, p. 121).
- Aliases for many GNU long options have been added to the
/opt/ast/bin built-in commands. Additionally, 'kill -s' now has
a --signal long option alias compatible with the util-linux
option.
- Backported support for 'print -u p' from ksh 93v- for
compatibility with scripts written for 93v-/ksh2020 (this is
equivalent to 'print -p').
Themes of this release:
- New table flags
--expand: changes a standard table view; expand the table structure so
internally all data will be displayed as inner tables
- NOTICE
The expand mode can be considered generally slower than a base table view.
So, if you have a large data set it may be slow.
--expand-deep {int}: set a limit after which table enlargement is stopped
--flatten: an --expand view option to return a set of values instead of
table for a simple lists
--flatten-separator {char}: a configuration of a separator for --flatten
--collapse: changes a standard table view; expand the table structure in a
squashed way
- NOTICE
collapse mode currently doesn't support width control, therefore if your
terminal is not wide enough the table might be broken. The collapse mode can
be considered generally slower than a base table view. So, if you have a
large data set it may be slow.
- Breaking changes
The command first 1 now returns a list with the single value rather than the
value itself. This brings it in line with the behaviour of last 1.
The dataframe command with-sql or query dfr has been renamed to query df for
consistency.
- Next Steps
We're continuing to work on language updates and hope to have more
information for you soon.