Crates.io | ru_shell |
lib.rs | ru_shell |
version | 0.1.3 |
source | src |
created_at | 2021-01-16 17:29:39.618071 |
updated_at | 2021-10-02 09:09:09.796756 |
description | A Shell built around a semantic grammar |
homepage | |
repository | https://github.com/storyfeet/gob_sh |
max_upload_size | |
id | 342859 |
size | 101,354 |
A Shell built in rust build around the bogobble parser system.
It has a few features not many shells have:
There is still plenty to do, but many things work
install using "cargo install ru_shell"
To set environment up you create a file called "$HOME/.config/rushell/init.rush"
In it put something like
A normal looking shell prompt
let RU_PROMPT=r#"${USERNAME,rushell} \e33m$PWD\n>>\e0m"#
Here :
r#".."#
reads a raw string whose contents will not be processed on input. This allows it to be processed, everytime the prompt needs to show.
\\e
is equivilent Esc[
Which is used to signal escape codes.
33m
/ 34m
Sets the color
0m
resets the color to defaults.
${varname, default}
if the var is empty, will use the default value
$PWD
refers to the variable directly but will throw show an error if the variable does not exist.
$(command args)
runs the command, and the output is treated as a single string arg.
The prompt I normally use
let RU_PROMPT= r#"\e1m\e34m${USERNAME,Matt}: :\e32m$(basename $PWD)\n\e34m>>\e0m"#
if you have starship installed you can use it like this:
let RU_PROMPT = r"$(starship prompt)"
The other environment variables RuShell explicitly uses are "PWD", "PATH" ,"RU_HIGHLIGHT", "RU_COMPLETE", however the latter two are not completely settled yet.
The "init.rush" file will be run at the beginning of each shell, and it handles acts as though you had just typed them all in at the file at the beginning of the session.
In General using Ru Shell should feel much like using any other shell, with a few notable exceptions.
Blocks are curly braced
for x in * {
echo $x
}
if true {
echo Its True
} else {
echo Its False
}
There is a keyword for disown
disown syncthing --no-browser
There are four ways to write to variables, they all look the same:
let x = a
set x = b
push x = :c
export x = d
echo $x
# prints b:c
Here's what they do
when reading variables, The current scope is checked first, then outwards, until finally environment variables.
All assigners can assign multiple variables at once.
let x y = a [4 5 6]
for m in $y {
echo $x -- $m
}
prints
a -- 4
a -- 5
a -- 6
Now allows comments "#" to end a line "##" to continue a line"
Fix so "\\n" doesn't insert a new line into output
tab complete works for choosing programs with "./" and "/" (TODO limit to executable)