Hackshell
Hackshell is a lightweight, customizable shell framework built in Rust. It provides an interactive command-line interface that can be easily extended with custom commands and integrated into your applications.
Features
- Async Command Processing: Built on Tokio for efficient async operations
- Task Management: Background task spawning, monitoring, and killing
- Environment Variables: Built-in environment variable storage and manipulation
- Rich Command Set: Comes with essential built-in commands like
help
,set
,get
,env
, etc. - Command History: Persistent command history between sessions
- Custom Context: Bring your own application context for deep integration
Built-in Commands
Hackshell comes with several built-in commands:
env
- List all environment variablesget <name>
- Get the value of an environment variableset <name> <value>
- Set an environment variableunset <name>
- Remove an environment variablehelp
- Show available commands and their descriptionssleep <seconds>
- Sleep for the specified durationexit
- Exit the shelltask
- Manage background tasks
Usage
You can find complete examples in the examples
directory. The following are quick examples.
Basic Example
use Path;
use Hackshell;
async
Adding Custom Commands
You can extend Hackshell with your own commands:
use Path;
use ;
;
async
Advanced Context Example
// Your custom commands can now access the AppState
;
async
Background Tasks
Hackshell allows you to spawn and manage background tasks:
// Spawn a background task
shell.spawn.await;
// List active tasks
let tasks = shell.get_tasks.await;
for task in tasks
// Kill a task
shell.kill.await?;
Installation
Add Hackshell to your Cargo.toml
:
[]
= "0.1.2"
= { = "1", = ["full"] }
= "0.1"
License
This project is licensed under the MIT License - see the LICENSE file for details.