rsh 0.67
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 version 0.67 of Rsh. This is release includes a new variable naming convention, improvements to module imports and file sourcing, and more.
Where to get it
Rsh 0.67 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 all the built-in goodies, you can install
cargo install rsh --features=extra
.
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
fdncred)
We have a new welcome banner (
You can disable the banner using the
config rsh
command to modify the config.rsh file,
just set show_banner
to false:
let-env config {
show_banner: false
...
}
jt)
New variable naming convention (WARNING! Breaking change!
In this release, we cleaned up some of the syntax parsing. The
major implication of it is that variable names can no longer
contain -
characters in it. Make sure to rename
your variables from kebab-case
to
snake_case
. This is true also for variables created
from command flags. For example, a --foo-bar
flag
in a command signature will be referenced by a
$foo_bar
variable.
kubouch)
Relative paths in scripts are file-relative (
When you use source
, use
, or
overlay add
with a relative path in a script or a
module file, the path is assumed to be relative to the file, not
the current working directory.
Example:
# script.rsh
use foo.rsh * # foo.rsh is assumed to be relative to script.rsh
fdncred)
Writing SQLite files (We added a fun way to create SQLite databases:
# create a database with a single table named `main`
ls | into sqlite my_ls.db
# same, but name the table `foo`
ls | into sqlite my_ls.db -t foo
Previously rsh was limited to reading SQLite database files. Now
we allow you to take tables or lists and create database files
like ls | into sqlite my_ls.db
. Currently this
functionality works with regular table output from commands,
table literals like [[col1 col2]; [a b] [c d]]
and
lists like [one 10mib 20sec 2 2.5]
.
fdncred and Tyriar)
Shell integration (@fdncred worked with @Tyriar from the Visual Studio Code team on shell integration. Now rsh will display round blue/red/gray decorations indicating the start of commands in the VS Code terminal:
rgwood)
Error Messages (
The error message when an external command is not found has been
improved. Rsh now displays fancy
miette
errors on all platforms including Windows, and it offers helpful
suggestions for typos and mistaken command names.
cmd.exe
changes (rgwood)
Windows
Potentially breaking change: Rsh no longer "shells
out" to cmd.exe
for any command that can't
be found - only
a few known cmd.exe
internal commands. This change improves error handling and error messages, but
let us know if it causes you any trouble.
Bits and Bytes (hustcer and WindSoilder)
rsh now has a full array of bits
and
bytes
commands for working with binary data.
@hustcer and @WindSoilder implemented the following:
- bits ror and bits rol
- bits shl and bits shr
- bits or and bits xor
- bits root command and bits and
- bits not
kubouch)
Hiding Environment Variables (
A new hide-env
command is added that can hide
environment variables in the current scope.
hide
still retains this functionality, but in the
future, we expect hide
to be able to hide only
parser definitions (commands and aliases). It is therefore
recommended to change your hide
calls to
hide-env
when dealing with environment variables.
Unlike hide
, hide-env
has a slightly
different signature: It accepts multiple arguments and the
arguments can be constructed dynamically:
> load-env {
ENV_FOO: 'foo'
ENV_BAR: 'bar'
}
> let prefix = 'ENV_'
> hide-env ($prefix + 'FOO') ($prefix + 'BAR')
kubouch)
Prefixed Overlays (
The overlay add spam
command would take all
commands and aliases from the module and put them directly into
the current namespace. Sometimes, however, you might want them
behind a prefix. That's what --prefix
is for.
Here is an example:
> module spam {
export def foo [] { "foo" }
}
> overlay add --prefix spam
> spam foo
foo
kubouch)
Customize Added Overlay Name (
You can now change the name of the added overlay using the new
as
keyword:
> module spam { export def foo [] { "foo" } }
> overlay add spam as eggs
> overlay list | last
eggs
> foo
foo
> overlay remove eggs
This can be useful if you have a generic script name, such as
virtualenv's activate.rsh
but you want some
more descriptive name for your overlay.
It is also compatible with the --prefix
flag
introduced above.
Next Steps
Time for a new engine!
We've been looking through the fixes we'd need for some of the issues we're seeing and decided rsh's core needs a thorough refactor. On this Notion page we started gathering ideas and design notes about features that we think should make it to the update. You can click the cards and they should expand into more detailed notes.
Many (most?) ideas are not polished yet and we need to work on
the full design before we start the implementation. Therefore,
we would like you to invite you to participate in the
discussion. If you have questions, comments and ideas, please
channel them to our #design-discussion
channel on
our Discord. We especially welcome thorough design writeups. You can even
"adopt" a topic and specialize in it, if you wish. And
of course, later, we'll need help implementing everything.
By the end of this, we'll be heading towards 0.80 which should have all, or most of, the features we want for 1.0 and the work from 0.80 to 1.0 is expected to be mostly polish, bugfixes, IDE integrations, stabilizing the language, etc.
Oh, and if you're scared this will turn into another engine-q, this time our goal is to try to make the updates incrementally instead of building a new rsh on the side and then replacing everything.
Full changelog
rsh
-
jt created
bump to 0.67, and
Fix intermittent test crash, and
bump dev version ahead of language changes, and
Move
ls
back to last-known-good state, and Revert cp and mv back to last-known-good state - skelly37 created Bug issue template
-
sholderbach created
Update to reedline 0.10.0, and
Update reedline to improved undo-system, and
Clippy fix for Rust 1.63, and
Reduce dev-deps by narrowing
rstest
features, and Makeopen
test independent of locale, and Patchlscolors
to not blink, and Update crossterm to version 0.24 -
elferherrera created
lazy dataframe reader, and
Polars upgrade 0.23, and
sqlite query without collect, and
use
from table
to remove into-db command, and maintain quotes for arguments - amtep created Add repository info to all workspace crates
-
rgwood created
Bump chrono dependency to fix panic, and
run_external: only suggest alternatives when file not
found, and
Clarify external command error, and
Fix unused import warning on Linux+Mac, and
Temporary: ignore Windows tests that fail on a local
machine, and
Support running batch files without typing their
extension, and
Clean up deprecated commands, and
Suggest alternative when command not found, and
Windows: only shell out to cmd for specific commands, and
Faster SQLite reads, and
Change
query
command toquery db
, and Add $OLDPWD example for cd -
kubouch created
Add 'as' keyword to 'overlay add', and
Add
hide-env
to hide environment variables, and Fix environment merging in hooks, and Allow overlays to import prefixed definitions, and Fix file lookup in parser keywords; Refactor rsh_repl, and Quickly patch wrong 'export' command name, and Allow modules touse
other modules - andrasio created cmd(df/first): returns the first row by default.
-
WindSoilder created
make
date format
supports locale, and not resolve symlink, and when spawned process during register plugin, pass env to child process, and add -n for path expand, so it doesn't follow symlink, and fix python plugin example, and In unix like system, set foreground process while running external command, and Make default env works better with bash style PATH, and Add bits not command -
fdncred created
make ci use rust-toolchain.toml, and
add rust toolchain file to pin rust version, and
update build scripts, and
Revert "Allow using the system's copy of zstd for
Polars", and
update a few rsh dependencies, and
remove sharkdp's lscolors repo again, and
add search terms to ignore command, and
bump lscolors to v12.0, and
escape single quotes and remove ansi escape sequences, and
new command
into sqlite
allows you to take lists and create a sqlite database, and add more verbose error messages to mv, and point to the latest main branch for lscolors, and remove the nana filename string, add some exclusions to gitignore, and replace the regex crate with the fancy-regex crate, and allow uppercase chars to be captured during suppressed input, and add a new welcome banner to rsh, and move application reset mode ansi sequence after cmdline execute -
nibon7 created
Add custom log target to debugging tips, and
Fix panic when building without git, and
Fix color settings for logger, and
Return error when moving a source directory to a target
directory whi…, and
Replace pretty_env_logger with simplelog, and
Refactor shell listing related code, and
Refactor shell switching related code, and
Make
g -
switch to the last used shell , and exportget_shells
andget_current_shell
, and Fix color parsing, and Return error early if seconds part of timestamp is invalid, and Fix touch panics when using invalid timestamp, and Fix path_contains_hidden_folder, and Prevent mv panic again, and Prevent mv panic -
merelymyself created
fix examples and let
into decimal
convert bools too, and makecd
,cp
,ls
,mv
,open
andrm
automatically strip ansi codes, and allow-h
flags forexport
subcommands, and adds aconfig reset
command - Kangaxx-0 created Fix issue 6223, and Tweak how rsh identifies custom command
-
hustcer created
upgrade chrono to v0.4.20, and
Some code refactor for shells related commands, and
add
bits ror
andbits rol
commands, and Addbits shl
andbits shr
command, and Addbits or
andbits xor
command, and Add bits root command andbits and
command, and bump to 0.66.3 dev version - winterqt created Allow using the system's copy of zstd for Polars
-
x3rAx created
Add decimals to int when using
into string --decimals
Extension
- fdncred created one last tweak before release, and prepare for new release, and update gitignore
- Yethal created Updated patterns and added generation script
Documentation
- amtoine created FIX: there is a minor typo in the modules page, and FIX: update the links to the default config files
- johnae created Update direnv.md, and Update config.js/cookbook with direnv example, and Create direnv.md
- azzamsa created docs: fix grammar error, and docs: contributing workflow is outdated, and fix: all clickable items should have the same color
- kubouch created Document hide-env and overlay additions
- willemneal created chore: small edit
- jeremiahpslewis created Update links to config template
- rgwood created Document SQLite data loading, and Explain how to launch Rsh after installing
- petrisch created DE Translation for Coloring and Theming
- fdncred created update gitignore
rsh_Scripts
- johnae created Update direnv example to run in pre_prompt rather than env_change, and Add direnv config example.
- fantasyzhjk created add rbenv script
- fdncred created update some scripts from dash to underscore, add 20k_club script, and update gitignore, and winget: switch kebab case parameters to snake case
- WindSoilder created Migrate some scripts to fit new variable and arguments naming style
- skelly37 created Unspanned error
reedline
-
sholderbach created
Prepare 0.10.0 release, and
Clippy fix for tests, and
Reduce dev-deps by narrowing
rstest
features, and Export the crossterm key types, and Update crossterm to 0.24 - morzel85 created Ctrl+h edit binding moved from emacs to common
- bnprks created Improve undo functionality, and Vi mode add support for d0, d^, c0, and c^
- fdncred created update gitignore