A simple and minimal UNIX shell inspired by Bash and Fish, written in pure Rust utilizing rustyline, a Rust alternative to GNU readline.
yui
is primarily interactive focused, although it does have a small parser for light scripting. I wrote it mainly to help me learn Rust, and the basics of interfacing and managing UNIX processes.
It is currently highly experimental and probably shouldn't be used as a daily driver yet.
You will need:
rustc
cargo
Clone the repo:
git clone https://github.com/rayes0/yui.git
cd yui
If you just want to try yui (dev version):
cargo run
Building:
cargo build --release
A sample config file is provided in the examples
directory. For full documentation, see https://github.com/rayes0/yui/wiki/Configuration
Click to expand!
- Documentation
Core
- Run basic commands with args
- Quoted strings:
""
and''
- Simple signal handling
- Exit code handling
-
~
expansion for homedir - Comprehensive bash-like history expansion:
-
!!
history expansion - bash-like "magic space"
- history expansion by both relative and absolute index
- Advanced expansion with globbing:
!*
,!$
,!^
- Reverse history search
-
- Differentiate between login and non login shell
- Job control
-
jobs
,bg
andfg
builtins - CTRL-Z
-
- Run command with temporary environment, eg:
PATH=/bin ls
- Run command from another directory without need for cd into it first
Editing
- Utilize vi or emacs modes to edit lines
- Support for multi-line commands (with
\
) - Support using external editor to edit commands
- Option for inline alias, variable, and history expansion
Parser
- small parser for light scripting only, mainly to make the config somewhat bashrc-like (partly finished)
- Full line comments starting with
#
- Partial line comments
-
if
conditionals
- Full line comments starting with
- functions
Operators and Syntax
-
test
,[
, and]
for testing conditionals-
==
,!=
,<
,>
-
- AND and OR:
&&
and||
- End of command:
;
- Basic arithmetic:
+
,-
,/
,*
,%
- Follow order of operations
- Float calculations
- Pipes via
|
- Redirections via
>
and<
-
\
for escaping characters - Support for globs:
*
,[...]
,?
,{...}
etc. - Command substitution (subshells?) through
$()
and backticked strings
Builtins
-
echo
- Print basic text
- Support printing styled text
- Support same flags as bash's builtin version
-
cd
-
exit
- Specify custom exit code
-
history
-
alias
-
exec
-
export
(env vars) -
bind
, to create custom keybinds -
set
, to change settings on the fly
Completion and Hinting
- toml files or similar for custom completions
- Directory and file completions
- Command completions
- Automatic completion hinting from history
- Intelligent hinting according to cwd
- Host completion for ssh
Customization
- Read settings from configuration file
- Optional truecolor support
- Simple prompt customization
Won't do (Things that will not be implemented into yui
, at least for the time being):
for
,while
,until
, etc. Any kind of looping - use a proper scripting language for that- "What! No
for
loops?!!. What if I need to loop over a directory of files?" - Use proper tools meant for that (eg: GNUfind
)
- "What! No
- Advanced arithmetic, precision above 8-9 digits, trigonometry, etc. - use an appropriate tool for that
- Advanced/special expansions:
$$
,${foo/foo/bar}
,${foo##.*}
, etc. - You should probably be using a proper scripting language if you need these
For those wondering, yes, it is named after the character Yui Hirasawa from the K-ON! series.