mysh

Crates.iomysh
lib.rsmysh
version
sourcesrc
created_at2024-01-25 02:20:09.134843
updated_at2024-12-06 10:35:13.68824
descriptionScaffolding to build interactive shells
homepage
repositoryhttps://github.com/yuzuquats/mysh
max_upload_size
id1113324
Cargo.toml error:TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
(yuzuquats)

documentation

README

mysh-rs

mysh, short for "My Shell", is a rust library for quickly building small interactive shells.

Usage

[dependencies]
mysh = "0.1.1"
futures = "0.3"
use mysh::{command, CommandArg};
use serde::Deserialize;

#[derive(CommandArg, Deserialize, Clone)]
pub struct Args {
  name: String,
}

#[command(
  name = "hello",
  description = "Prints hello world",
  long_description = "Prints hello world" // optional
)]
pub async fn hello(_: UserInfo, args: Args) -> mysh::Result<()> {
  println!("Hello {}", args.name);
  Ok(())
}
use mysh::Shell;
use tokio;

#[derive(Clone)]
pub struct UserInfo {}

// #[tokio::main] // or
#[actix_rt::main]
async fn main() {
  Shell::new(UserInfo {})
    .add_command(hello)
    .run()
    .await;
}

Trigger read-eval-print-loop

cargo run

>> hello --name World
Hello World

Run single command

cargo run -- hello --name World
Hello World

Run Examples

cargo run -p simple
Commit count: 44

cargo fmt