#shell #cmd #subprocess #interactive-shell

ishell

Pseudo-interactive shell interface for Rust

13 releases

new 0.3.1 Jan 26, 2025
0.3.0 Jan 22, 2025
0.2.3 Jan 21, 2025
0.1.8 Jan 19, 2025

#861 in Filesystem

Download history 722/week @ 2025-01-15 364/week @ 2025-01-22

1,086 downloads per month

Custom license

25KB
345 lines

IShell - (pseudo)interactive shell

Rust

The main goal was to make a shell interface that remembers cd commands.

You can create a new shell by simply doing:

// Will open a shell in the same directory as the shell running the program
let shell = IShell::new();

You can also specify where to open the shell initially:

// Parameter here is an `&str` or `&Path`, corresponding to
// the initial directory from where the command will be ran.

// No matter from where you run the program,
// the shell will always be created at ~/Desktop
let desktop_shell = IShell::from_path("~/Desktop");

To run a command through your shell, you can do the following:

shell.run_command("echo 'Hello, World!'");

The run_command method also returns std::process::Output type.

You can also call

shell.forget_current_directory();

To make the shell set current directory to the initial directory specified. If initial directory wasn't specified, then this sets the current shell directory to the $PWD of the terminal running the program.

Dependencies

~0–6.5MB
~38K SLoC