mxsh 0.2.0

Embeddable POSIX-style shell parser and runtime
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use mxsh::ShellBuilder;
use mxsh::policy::{ShellIdentity, VariableAttributes};
use mxsh::runtime::unix::UnixRuntime;

fn main() {
    let argv: Vec<String> = std::env::args().collect();
    let mut shell = ShellBuilder::new()
        .identity(ShellIdentity::named("toysh").with_default_history_file(".toysh_history"))
        .env("PS1", "toysh> ", VariableAttributes::empty())
        .build(UnixRuntime::new())
        .expect("shell should build");
    let outcome = shell.run_cli(&argv);
    std::process::exit(outcome.exit_code.unwrap_or(outcome.status));
}