GitHunt
HA

Own shell implementation in Rust

Civa

Build Status
codecov

A own implementation of a shell

Goals

  • Learn UNIX more
  • Learn rust more, try not to rely on shell impls in rust, but learn it the hard way
    • Don't use clone (only if reasoned well)
    • Use generics if useful
    • Use lifetimes if useful
  • As long as I don't know how dirty code and programs look, I can not build clean code and programs
  • Build something I would use, with the approach the build a minimal working program
    and improve it while reaching its limits

Features

Sequential execution

$ ls || echo "Hello World"
# Same as
$ ls ; echo "Hello World"
# Same as
$ ls && echo "Hello World"

Piping

$ ls | cat

Sudo Substiution

Sudo can be invoked by using ! at the end of a command

$ sudo ls

# equal to

$ ls !

Comes in handy especially when forgetting to use sudo at the beginning of the command

Arithmetic Evaluation

Calculations have to start with a $

$ $ 1 + 1
2

Reserved keyword it for using last result

$ $ 1 + 1
2
$ $ it + 3
5

On the fly arithmetic evaluation which shows the result while typing

Arithmetic Evaluation

Todo

  • Make Signal Handling proper (use rustyline or signal_hook?)
  • Clip Board
  • Improve UI
  • Handle command splitting
  • Implement PATH search and correct command handling (depending on slash)
  • Autocompletion menu and man page/command line autocompletion
  • Handle piping
  • Make Alias System
  • Integration of CMS
    • Git
    • SVN
  • Build a config system (python?)
    • Command Bar (UI)
    • Aliases
  • Use opiniated builtin alternatives to the GNU/Unix tools
  • Tests! (look for good mock library)
  • Thinking of ways to improve shell workflows (own opinion)
  • Read more
  • Setup a more solid test environment, like the exa project with vagrant

Custom Builtins

Sources

Languages

Rust97.9%Shell1.4%Python0.7%

Contributors

MIT License
Created April 15, 2020
Updated January 10, 2024