nixpulvis / oursh

Your comrade through the perilous world of UNIX.
http://nixpulvis.com/oursh/oursh
MIT License
67 stars 6 forks source link
posix rust shell

oursh

Documentation CI Dependencies

This shell should be both POSIX compatible and yet modern and exciting. Fancy features should not be prevented by POSIX compatibility. This will effect the design of the shell.

The name of the shell is oursh which is both somewhat unique, and memorable. It's also a nice name to play with pseudo-satirical themes... right comrade? It's short (ish) and sneakily fits rs in it, which is the extension of Rust programs, the language this will be written in.

Features

Releases, Tags, and Branches

The master branch will run both the release and ci actions, whereas develop only runs ci. All pull requests into master and release tagged (i.e. vX.Y.Z) pushes also trigger release builds.

Usage

While this project is in early stages, there are no OS packages to use. However, you can compile and run directly from source easily. Just ensure you have rustup installed.

cargo build
cargo run

Testing

We have four kinds of tests in this program. Crate unit tests, Executable unit tests, subprocess based integration tests, and documentation tests.

# Run all tests.
cargo test

Previous Work

I've been using fish as my main shell for a few years now. Fish inspires a lot of the modern syntax.

POSIX compatibility comes from my desire to use this shell as my chsh -s ... shell on Arch Linux. See the full POSIX reference for more information.

Some of the shebang language interoperation was inspired by my time with the Northeastern University PL group, and generally from writing Racket. The beauty of of merging the UNIX style #!... with Racket's #lang ... here is very exciting to me. I might just have to make a {#lang ...} shortcut for Racket!

I've built and wrote a few things about shells before:

POSIX Reference

See the following sections for building the POSIX sh compliant program language, and interactive terminal based REPL.

Implementation

This shell will be written in Rust with minimal dependencies. Notably termios and libc will likely be used. The parsing library will be lalrpop, which should support the syntax we want somewhat easily, though grammar's in general can be a tricky beast.

We will want to create a few internal modules for the shell.

This design is subject to change.


Current modules as of: 2018-10-14

 oursh : crate
 ├── job : public
 ├── program : public
 │   ├── basic : public
 │   └── posix : public
 │       ├── ast : public
 │       │   └── tests : private @ #[cfg(test)]
 │       ├── builtin : public
 │       └── lex : public
 │           └── tests : private @ #[cfg(test)]
 ├── repl : public
 │   ├── completion : public @ #[cfg(feature = "completion")]
 │   └── history : public @ #[cfg(feature = "history")]
 └── tests : private @ #[cfg(test)]└── tests : private @ #[cfg(test)]