rsh 0.85
rsh, or Rsh 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.85 of Rsh. This release adds the first uutils command, unlocks more constant evaluation at parse time, and polishes many commands.
Where to get it
Rsh 0.85 is available as
pre-built binaries
or from
crates.io. If you have Rust installed you can install it using
cargo install rsh.
NOTE: The optional dataframe functionality is available by
cargo install rsh --features=dataframe.
As part of this release, we also publish a set of optional
plugins you can install and use with Rsh. To install, use
cargo install rsh_plugin_<plugin name>.
Themes of this release / New features
rsh + Uutils = ❤️
📢The rsh team is thrilled to announce 🥳 that we've begun
working with the
uutils/coreutils team on integrating some of
their foundational core utilies into rsh. With this release, we've started with the coreutils
cp command, which we've temporarily named
ucp. We're starting with ucp to
allow broad testing while the current rsh
cp command remains the default. We've already
found one
bug
in the coreutils cp command and you might find
others. Once it stabelizes, probably with the 0.86.0 release,
we'll remove the rsh cp command and rename
ucp to cp. In keeping with the rsh
style, we've only added a handful of parameters. We can, and
probably will, add more if the community determines we need
them. We're so very excited and would like to thank
terts, from the coreutils team, for his excellent help and special
appreciation to
dmatos2012
for the, very iterative, first
uutils/coreutils integration PR
#10097
for the cp command. To read more about how this
came to be, checkout
our blog post.
Quite a few bug fixes
Thanks to all the contributors below for helping us solve issues and bugs 🙏
| author | description | url |
|---|---|---|
| @rgwood | Fix watch not detecting modifications on Windows | #10109 |
| @ito-hiroki | Fix tab completion order of directories to consistent with order of files | #10102 |
| @herobs | Fix 9156 endian consistency | #9873 |
| @ayax79 | fixed usages of deprecated chrono DateTime::from_utc | #10161 |
| @zhiburt | Fix #10154 | #10162 |
| @ofek | Fix example history command pipeline | #10220 |
| @dead10ck | Fix unit tests on Android | #10224 |
| @amtoine | fix default after an empty where | #10240 |
| @IanManske | Fix rm on macOS |
#10282 |
| @horasal | handle empty pipeline while parsing let (fix Issue10083) | #10116 |
| @dmatos2012 | Fix variables not allowed in ucp | #10304 |
| @sholderbach |
Update crates-ci/typos and fix new typos
|
#10313 |
| @GomesGoncalo | fix #10319: allow json request of value type list | #10356 |
| @jntrnr | fix 'let' to properly redirect | #10360 |
| @amtoine | fix the pretty printing of failing tests in std | #10373 |
| @J-Kappes | fix input --until-bytes: now stops at any of given bytes | #10235 |
| @zhiburt | rsh-table: Fix expand table unnessary color in trail head config when wrap is used | #10367 |
| @fdncred | fix some new chrono warnings | #10384 |
| @horasal | prevent crash when use redirection with let/mut | #10139 |
| @horasal | Allow operator in constants | #10212 |
| @zhiburt | rsh-table: Patch restore lead trail space bg color | #10351 |
| @zhiburt | rsh-table: Strip custom color in the header when used on border | #10357 |
Consistent use of float for our floating point type
Breaking change
See a full overview of the breaking changes
rsh currently supports two types to represent numbers without
units: int for integer numbers and
float for floating point numbers. The latter type
was in important places incorrectly referred to as
decimal. This hid the fact that as floating point
numbers they have limited precision in some circumstances but
higher performance compared to a decimal-encoded number.
With this release we fix this inaccuracy.
This means we introduce the commands into float and
random float and deprecate the commands
into decimal and random decimal. The
old commands will be removed with the next release but continue
to work for this release with a warning. Please use
into float instead of into decimal and
random float instead of
random decimal.
After the type returned by describe has been
float for a while, we now also change which type
name is allowed when specifying command argument or input/output
types.
# Argument with a specfic type
def foo [bar: float] {}
# Command taking only floating point input from the pipeline and returning the same type.
def baz [] float->float {}
Previously both float and decimal were
supported in those positions.
Some updates on explore
Breaking change
See a full overview of the breaking changes
The explore built-in commands have changed a bit
during this release.
Now, it supports Vim bindings out of the box thanks to @amtoine in #9966. @rgwood has simplified the available configuration entries which used to make the command less easy to understand in #10258#10259 and #10270.
Thanks to him again, one can now quit the explorer
by hitting any of ctrl+c, ctrl+d or
ctrl+q (see
#10257).
Improvements to parse-time evaluation
Conditional source and use is now
possible.
The rsh core team has been asked quite a lot of times to be able
to do parse-time conditional sourceing or
useing in the configuration, e.g. to load different
things depending on the system:
if $rsh.os-info.name == "windows" {
source "my_windows_config.rsh"
} else {
source "my_unix_config.rsh"
}
The above snippet does not work because rsh's scoping rules keep the sourced values inside the block and the sourcing would not have any visible effect outside of the if/else statement (except environment changes).
While scoping still works the same, a series of PRs by
@kubouch
made conditional source/use/overlay use
possible:
- #9499, allows parse-time evaluation of commands, pipelines and subexpressions (see also Looking for help!)
-
with
#10326,
ifcan now be evaluated at parse time -
finally,
#10160
makes the
$rshbuilt-in variable a true constant 🥳
What does this all mean? One can now write something very similar to the proposed snippet above! For example:
const WINDOWS_CONFIG = "my_windows_config.rsh"
const UNIX_CONFIG = "my_unix_config.rsh"
const ACTUAL_CONFIG = if $rsh.os-info.name == "windows" {
$WINDOWS_CONFIG
} else {
$UNIX_CONFIG
}
source $ACTUAL_CONFIG
Looking for help!
#9499 allows running selected commands at parse time. For example,
const f = ($rsh.default-config-dir | path dirname)
is possible because path dirname was manually
ported to allow parse time evaluation. Only a very limited
subset of rsh's commands is currently allowed to do so:
str lengthpathcommands-
Some core commands:
describe,ignore,version,if
We would like to expand this set to allow more commands to run at parse time. If you'd like to help us porting more commands, we'd welcome your help! Please, see #10239 for more information. Porting the commands is not difficult, but requires a bit of consideration, so it's better to reply to the issue or reach out to the core team beforehand.
Improving accessibility
Up until now, an issue for users using a screen reader was that rsh errors and tables are quite fancy with some unicode characters. The issue is that screen reader might have trouble reading them, making the understanding of what's going on the REPL very hard...
For tables, it's quite easy, you can set
$env.config.table.mode to something like
"basic" or
"none" and you should be good! But errors
remained fancy
Error: rsh::shell::external_command
× External command failed
╭─[entry #4:1:1]
1 │ foo
· ─┬─
· ╰── did you mean 'for'?
╰────
help: No such file or directory (os error 2)
@JoaquinTrinanes did implement screen reader-friendly errors in #10122 which will hopefully make the experience a lot better when it comes to errors.
More support for more platforms
In this release, @dead10ck made it possible to use rsh in Termux (#10013) and fixed a bug on Android (#10225).
Improved history isolation
Breaking change
See a full overview of the breaking changes
Like many other shells, history between open sessions can be
isolated in rsh. However, the former implementation had the
disadvantage that it also blocked access to history of former
sessions. It also didn't isolate hints. This is now fixed
with
!10402
by
@Hofer-Julian. Since this was merged shortly before the release, this
feature isn't the default yet. The
file_format has to be changed to
"sqlite" and isolation has
to be set to true. You can find those in the
config file
under $rsh.config-path. Please test this so we can
fix problems before history isolation becomes the default.
Enhancing the documentation
Thanks to all the contributors below for helping us making the documentation of rsh commands better 🙏
| author | description | url |
|---|---|---|
| @Hofer-Julian | Add notice to enable develop mode on Windows | #10111 |
| @fdncred | update query web example because wikipedia changed their page | #10173 |
| @alsuren | Point from keybindings help to the book's reedline chapter | #10193 |
| @sholderbach |
Document that open looks up
from subcommands
|
#10255 |
| @balupton | readme: add dorothy to supported by | #10262 |
| @brunerm99 | feat: Search terms for use, while, and range (#5093) | #10265 |
| @amtoine | add case-insensitive example to where |
#10299 |
Help with tests
Some more technical work but very helpful to make the source code of rsh better, so thanks to our contributors who did improve the tests, often going through the whole source base and doing tideous find and replace 🙏
| author | description | url |
|---|---|---|
| @J-Kappes | Tests: clean up unnecessary use of pipeline() | #10170 |
| @sholderbach | Remove dead tests depending on inc |
#10179 |
| @sholderbach | Simplify rawstrings in tests | #10180 |
Changes to commands
As usual, new release rhyms with changes to commands!
-
a bunch of new columns have been added to the
pscommands:- @fdncred in #10275 and #10344
- @WindSoilder in #10347
-
@nanoqsh
has made the behaviour of
appendandprependconsistent regarding ranges in #10231 -
@Tiggax
has started working on making
select,getandrejectmore consistent in #10163 and #10216 -
Breaking change:
mathconstants have been moved from built-in commands to true constants in the standard library by @amtoine in #9678 -
the
into durationcommand now accepts integers as arguments and the unit can be specified via an option with the changes introduced by @amtoine in #10286 -
thanks to
@fdncred
in
#10354, the
commandlinecommand can now move you to the end of the line, no need to "move 1000 characters to the right" anymore
Some table themes
Want more delight? @fdncred got you covered. He added a bunch of new table themes / modes in #10279.
echo is evolving
Coming from other shells, e.g. POSIX ones like Bash or Zsh, the
distinction between rsh's echo and
print commands and the behaviour of
echo itself could be confusing 🤔
-
printis a more programming-language-friendly command: it does print its arguments to the terminal directly, consuming them and thus not allowing to pipe the "output" of print further. -
echowas only used to create values and pass them down a pipeline, e.g.echo "foo" | str length
@jntrnr
made the behaviour of echo a bit more general
- it will print to the terminal if not redirected
- it will pass the value down to the pipeline if redirected
echo "foo" # will behave exactly as `print` does
echo "foo" | str length # will compute the length of `"foo"` and forward the result without
# "printing" it unless it's the last command being run
Pythonesque operators removal
Breaking change
See a full overview of the breaking changes
Coming from Python, things like
3 * "foo"
[1, 2] * 10
would probably appear familiar.
However, they could lead to some strange internal behaviours and hard to debug issues 😕
> [3, "bob", 4] | reduce --fold 1 {|x, y| $x * $y}
bobbobbobbobbobbobbobbobbobbobbobbob
Note in the example above, we are mixing integer and string multiplication, which might get weird!
In this release, we decided to remove the string and list scalar multiplication in #10292 and #10293 from @sholderbach.
However, we do not want to leave you without any other way to
achieve the same, this is why
@amtoine
did implement the repeat command in the standard
library in
#10339
-
bring it into your scope with
use std repeat -
you can do scalar string multiplication with something like
"foo" | repeat 3 | str join -
you can do scalar list multiplication with something like
[1, 2] | repeat 3 | flatten
Optimizations
#10378
Switched the default allocator to mimalloc as
it's shown to reduce startup time by upwards of 30% on
Windows. If it does not build on unique platforms rsh can be
built without this feature, then using the platform's
default allocator.
New commands
-
into floatas a replacement forinto decimal -
random floatas a replacement forrandom decimal
In the standard library we added the following commands:
-
std repeatas a command to repeat an elementntimes in a list. -
std formats from ndjsonas a way to directly open newline-delimited JSON recrods. You can useopenfor files with the.ndjsonending if youuse std formats "from ndjson". -
std formats from jsonlas a way to directly open newline-delimited JSON records. You can useopenfor files with the.jsonlending if youuse std formats "from jsonl".
Deprecations
Deprecated commands
-
into decimal: Useinto floatinstead -
random decimal: Userandom floatinstead
Breaking changes
- Plugin authors need to update plugins after the span refactor
- Updated plugins need to be recompiled
-
#10235
input --until-bytesnow stops at any of given bytes -
#10333
Consistently use
floatinstead ofdecimalin type specifications -
#10293
Remove pythonic
string * listmultiplication -
#10292
Remove pythonic
int * listmultiplication -
#10338
Change
echoto print when not redirected -
#10259
explore: remove
:config,:show-config,:tweakcommands -
#9929
Rename the types with spaces in them to use
- - #10254 Change LOG_FORMAT to rsh_LOG_FORMAT in rsh-std library
- #9678 Move math constants to standard library
-
#10231
Make
append/prependconsistent for ranges -
#9966
Add support for Vim motions in
explore - #10042 Spanned Value step 1: span all value cases
-
#10103
Create
Recordtype -
#10064
Fully remove
str replace --stringoption after deprecation. Just usestr replaceinstead.
Full changelog
rsh
- tokatoka created
-
sholderbach
created
- Clippy in tests
-
Update internal use of
decimaltofloat -
Optimize use of range in
std repeat - Remove python-like string multiplication
-
Invert
&Options toOption<&T> -
Remove pythonic
int * listbehavior -
Rename
random decimaltorandom float -
Rename
into decimaltointo float -
Deref
&Stringarguments to&strwhere appropriate -
Use slices directly instead of
&Vec -
Bump
calamineand fix clippy -
Update
crates-ci/typosand fix new typos -
Remove
Cargo.lockin subcrates -
Move spellcheck config into
.githubfolder - Remove codecov.io setup
-
Document that
openlooks upfromsubcommands - Tweak contributor image to include more users
-
Update
crossterm/ratatui/dev-reedline - Simplify rawstrings in tests
-
Remove dead tests depending on
inc -
Keep
arrow2out of basic--workspacebuild
-
fdncred
created
- fix some new chrono warnings
- add helper switch to move cursor to end of buffer
-
add a few more columns to linux
ps -loutput - silence some ucp warnings
- allow update to use metadata
- add 6 more table themes
- respect a users locale with the right prompt
-
add more
pscolumns in Windows - update format date when using %x %X %r
- Restore rsh_LIB_DIRS and rsh_PLUGIN_DIRS defaults
-
allow
--loginto be used with rsh's--commandsparameter - add plugin path when there are no signatures
- update query web example because wikipedia changed their page
- name hooks internally
- bump rust-toolchain to 1.70.0
- FilipAndersson245 created
- zhiburt created
- J-Kappes created
-
amtoine
created
- fix the pretty printing of failing tests in std
-
add
std repeatcommand to replace"foo" * 3 -
add case-insensitive example to
where -
allow
into durationto take an integer amount of ns -
rename the types with spaces in them to use
- - fix default after an empty where
- move math constants to standard library
- support tab completion cycling
-
add support for Vim motions in
explore
- WindSoilder created
- jntrnr created
- GomesGoncalo created
- Tiggax created
- kubouch created
- hustcer created
- geniusisme created
- utouto97 created
- nanoqsh created
- app/dependabot created
- dmatos2012 created
- dzorya created
- nibon7 created
- alsuren created
- IanManske created
- rgwood created
- brunerm99 created
- balupton created
- stormasm created
- horasal created
- dead10ck created
- ofek created
- MasterMach50 created
- matthias-Q created
- ayax79 created
- SED4906 created
- JoaquinTrinanes created
- Hofer-Julian created
- herobs created
- ito-hiroki created
Extension
- nerditation created
- adamcstephens created
Documentation
- Gryff created
- edhowland created
- dnsem created
- petrisch created
- mb21 created
- connorjs created
- JoaquinTrinanes created
- hustcer created
- sholderbach created
- stormasm created
- alsuren created
- dclausen created
- simonboots created
- leetemil created
- adamchalmers created
- follower created
- jamesarch created
- narve created
- dlamei created
- lomm28 created
- fdncred created
- rgwood created
- app/github-actions created
- jntrnr created
rsh_Scripts
- amtoine created
- WindSoilder created
- Zinvoke created
- brunerm99 created
- icp1994 created
- selfagency created
- fnuttens created
- maxim-uvarov created
- StripedMonkey created
- AntoineSebert created
Reedline
- sholderbach created
- ysthakur created
- Hofer-Julian created
- Abdillah created