Skip to content

Latest commit

 

History

History
170 lines (145 loc) · 6.8 KB

README.creole

File metadata and controls

170 lines (145 loc) · 6.8 KB
 ▄████████    ▄████████ ███    █▄     ▄████████     ███
███    ███   ███    ███ ███    ███   ███    ███ ▀█████████▄
███    █▀    ███    ███ ███    ███   ███    █▀     ▀███▀▀██
███         ▄███▄▄▄▄██▀ ███    ███   ███            ███   ▀
███        ▀▀███▀▀▀▀▀   ███    ███ ▀███████████     ███    
███    █▄  ▀███████████ ███    ███          ███     ███    
███    ███   ███    ███ ███    ███    ▄█    ███     ███    
████████▀    ███    ███ ████████▀   ▄████████▀     ▄████▀  
             ███    ███

crusty mascot

^ Say hello to crust's mascot :D ^

crust is a WIP shell written in Rust by Phate6660 and Zenomat.

Some of the functionality is split off into features, to reduce the amount of crates pulled in by default. They are:

  • colors (for colorized output in ls (and other builtins once implemented))
  • readline (a default feature (but can be turned off), for having a nice interactible prompt)
    • when disabled, you'll have very basic line input (think of shells like dash)
    • NOTE: the prompt is customizable regardless of whether or not you choose to enable the feature
  • time (for getting the time with the %{D12} and %{D24} variables)

If you don't want any features at all, then build or run with the arg --no-default-features.

Running

To run an interactive shell:
cargo run --release

To run a non-interactive shell with a command:
cargo run --release -- -c "echo test | sed s/test/success/g"

Roadmap

Shell

FEATURE TODO WIP DONE
Basic commands X
CMDs with args X
Paging X
Piping X
Prompt X
Redirection X
Builtins X
Config file X
Job control X
Line editor X
Env variables X
Scripting X

Prompt

FEATURE TODO WIP DONE
Automatically update X
Colors X
Command output X
File content X
Replaceable variables X
Set via env var X

The default prompt looks like:
Default Prompt

Customize the prompt by setting the PROMPT variable in the environment or through the config.
What you can use in the prompt:

Information variables:

  • %{CL} for the full current working directory (e.g. /home/valley/projects/crust).
  • %{CS} for the short current working directory (e.g. crust).
  • %{D} for the date (e.g. Wed Dec 15).
  • %{H} for the current user's home directory.
  • %{T12} and %{T24} for 12 and 24 hour time respectively.
  • %{U} for the current user.
  • %(command) for capturing the output of command.
  • %[file] to get the contents of file.

Formatting:

  • %{b} to make text bold.
  • %{i} to italicize text.
  • %{rb} to reset the background color.
  • %{re} to reset all text attributes.
  • %{rf} to reset the text color.
  • %{u} to underline text.
  • B<COLOR> for changing the background color.
  • F<COLOR> for changing the text color.
  • \n for newline.
  • Anything else will be printed as-is.

COLOR should be replaced with one of:

  • BLACK
  • RED
  • GREEN
  • YELLOW
  • BLUE
  • MAGENTA
  • CYAN
  • WHITE

Example for formatting:
PROMPT="%{b}F<MAGENTA>%{T24}%{re} - %{i}%{U}@%(hostname)%{re}\nB<GREEN>F<BLACK>%{CL}%{re}» "
Which for me looks like this:
Customized Prompt
This showcases a multiline prompt with different foreground and background colors, as well as a command substitution and shell-prompt-features, like time and user.

Line Editing

Basic Line Editing
FEATURE TODO WIP DONE
Command Input X
Arrow Keys X
Backspace X
Rustyline
FEATURE TODO WIP DONE
Basic line editing X
Command history X
Completions X
Modifiable keybindings X
Syntax highlighting X

Builtins

calc

FEATURE TODO WIP DONE
Basic math X
Equations X
PEMDAS X

cat

FEATURE TODO WIP DONE
Read file X
Print line numbers X
Print specific line X
Paging support X
Syntax highlighting X

cd

FEATURE TODO WIP DONE
Exact paths X
Relative paths X
Previous dir X

echo

FEATURE TODO WIP DONE
Basic output X
Escape sequences X

help

FEATURE TODO WIP DONE
Invidual helps for builtins X
List builtins X
Quick start / tutorial X

ls

FEATURE TODO WIP DONE
Basic colored output X
Cross-platform X
List files X
Additional details X

Config File

OPTION TODO WIP DONE
Edit mode X
History auto add lines X
History file X
History ignore spaces X
History size X
Prompt X

Notes:

  • A default config is created for you if non-existant, look at example-config in the repo for an example.
  • Comments (lines that start with *) or ignored.
  • Invalid options are ignored and a warning is issued.