rsh 0.17.0
rsh, or Rsh for short, is a new shell that takes a modern, structured approach to your commandline. 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 commandline pipelines.
Today, we're releasing 0.17 of Rsh, the first Rsh to include WebAssembly, custom keybindings, and much more.
Where to get it
Rsh 0.17.0 is available as
pre-built binaries
or from
crates.io. If you have Rust installed you can install it using
cargo install rsh.
If you want more goodies, you can install
cargo install rsh --features=stable.
As part of this release, we also publish a set of plugins you
can install and use with Rsh. To install, use
cargo install rsh_plugin_<plugin name>.
What's New
WebAssembly support (jonathandturner) and upcoming wasm-based playground (jzaefferer, jonathandturner)
Nu, now in your browser
As part of on-going cleanup and portability work, with 0.17 it's now possible to build Rsh and target WebAssembly, allowing you to run Rsh in the browser and call into it from JavaScript. This is the first (experimental!) step in building towards an interactive playground and possibly more. We're hoping to talk more about this porting process in the coming days.
If you'd like to see what we're building, check it out.
Custom keybindings (jonathandturner)
rsh now also supports custom keybindings. To configure your keybindings, you can add a keybindings.yml file beside your config file. You can find out the location for your system using:
> echo $rsh.keybinding-path
/home/jonathan/.config/rsh/keybindings.yml
You can base your custom file off this example keybindings file.
New commands
benchmark (pag4k)
The new benchmark command will time a block and
output the length of time it took to run:
> benchmark { echo "hello" }
363us 528ns
str reverse (JosephTLyons)
The str reverse command will reverse the characters
of a string:
> echo "hello world" | str reverse
dlrow olleh
str length (jonathandturner)
On a related note, you can now also get the length of a string.
> echo "hello world" | str length
11
str from (bailey-layzer)
In previous versions of Rsh, it was difficult to format numbers
for precision and digit grouping. Starting with 0.17,
there's now a new str from subcommand to help
with this.
> echo 1.456123 | str from --decimals 2
1.46
> echo 1234567 | str from --group-digits
1,234,567
math stddev and
math variance (amousa11)
You can now calculate standard deviation and variance in your numeric datasets:
> echo [ 1 2 3 4 5 ] | math stddev
1.414213562373095048801688724209698078569671875376948073176679737990732478462107038850387534327641573
> echo [ 1 2 3 4 5 ] | math variance
2
if (jonathandturner)
Ever want to run one block if a condition was true and another if the condition was false? Now you can!
> echo 0..5 | if $it > 3 { echo big } { echo small }
───┬───────
0 │ small
1 │ small
2 │ small
3 │ small
4 │ big
5 │ big
───┴───────
The keen observer might notice we're stealthy sneaking in more commands you might use in future scripting.
split chars (jonathandturner)
To more easily work with the characters in a string, you can now split the characters into separate items:
> echo "hello" | split chars
───┬───
0 │ h
1 │ e
2 │ l
3 │ l
4 │ o
───┴───
move column (andrasio)
Finally, you can now move columns in your table:
> ls
───┬──────────────────────────────────┬──────┬─────────┬────────────
# │ name │ type │ size │ modified
───┼──────────────────────────────────┼──────┼─────────┼────────────
0 │ 0.bootstrap.js │ File │ 30.9 KB │ 1 hour ago
1 │ 46a44c28f12d33243854.module.wasm │ File │ 5.4 MB │ 1 hour ago
2 │ bootstrap.js │ File │ 16.3 KB │ 1 hour ago
3 │ index.html │ File │ 1.4 KB │ 1 hour ago
───┴──────────────────────────────────┴──────┴─────────┴────────────
> ls | move column size --before type
───┬──────────────────────────────────┬─────────┬──────┬────────────
# │ name │ size │ type │ modified
───┼──────────────────────────────────┼─────────┼──────┼────────────
0 │ 0.bootstrap.js │ 30.9 KB │ File │ 1 hour ago
1 │ 46a44c28f12d33243854.module.wasm │ 5.4 MB │ File │ 1 hour ago
2 │ bootstrap.js │ 16.3 KB │ File │ 1 hour ago
3 │ index.html │ 1.4 KB │ File │ 1 hour ago
───┴──────────────────────────────────┴─────────┴──────┴────────────
Early draft of a new website (pontaoski)
We're working on a refresh of our website. If you're interested in giving it a look, we've got an early draft started. If you'd like to help us with the design, reach out over github or discord.
Command improvements
-
sort-bycan now sort with case-insensitivity (JosephTLyons) -
aliasof externals should now be improved (bailey-layzer) -
historyshould be able to correctly store more than 100 rows now (fdncred) -
to htmlwill now output pretty hex when given a binary it doesn't recognize (jonathandturner), and now has color themes (fdncred) -
uniqcan now also work with simple values (k-brk) - Completions now have their own abstraction, so we can more easily improve them in the future (thegedge)
-
tablenow prints column numbers a bit more orderly way (Porges) -
strmade parsing more strict, to let the user know if there were parsing errors (andrasio) -
group-bycan now take a block that allows for deep keying for grouping (andrasio) - autoenv (directory-specific environments) can now run commands on entry/exit (samhedin)
-
str trimcan now take an optional character to trim (bailey-layzer) - duration pretty-print is now easier to read (jonathandturner), durations are also now stored as nanoseconds internally (pag4k)
-
str substringsupports more argument types now (andrasio) - completions for filepaths should now work in more cases (almindor)
rmnow gives nicer output (arashout)-
ls -fwill now do a better job of keeping the tables aligned (arashout) - general parser improvements (philip-peterson, jonathandturner)
-
eachcan now number the outputs it creates, allowing for enumeration (jonathandturner)
Bug fixes, tests and more (philip-peterson, JosephTLyons, u5surf, thegedge, arashout, jonathandturner)
Parsing now has more test coverage. Internal code cleanups.
Command description copy paste issues fixed. Ensure that the
MaybeTextCodec gets properly cleared. Fix documentation to
renamed subcommands and str to-int. Internally more
commands were moved to process their streams lazily. We can now
generate documentation from reading the built-in docs on each
command.
Breaking changes
BSON and Sqlite move to plugins (jonathandturner)
As part of the portability work, we've moved the
from bson, to bson,
from sqlite and to sqlite out of
internal commands and into plugins. The functionality should
remain largely unchanged, with the only difference being that
you'll need to install these plugins for this functionality.
Command renames
-
calcis nowmath evalto join themathsubcommand family (coolshaurya) -
keep-untilandkeep-whileare now subcommands:keep untilandkeep while(k-brk) -
skip-whileandskip-untilare also now subcommands:skip whileand skip until (andrasio) -
configis now split into subcommands based on the command flag, eg)config set,config get, etc. (ritobanrc, jonathandturner)
Looking forward
Just when we think we'll slow down a little, we're surprised by the amount of community feedback and help. This release covered nearly 4(!) pages of pull requests. Not bad for three weeks for work!
There's some parser work coming up to help continue removing roadblocks to using Rsh as a scripting language, improving completions, and generally continuing to polish Rsh.