shitbox/src/cli.rs
2022-12-20 12:05:21 -05:00

27 lines
876 B
Rust

use crate::cmd::{bootstrap, echo, head, hostname, r#false, r#true};
use clap::{value_parser, Arg, ArgAction, Command};
pub fn run() {
let matches = Command::new("shitbox")
.about("The Harbor Freight multitool of embedded Linux")
.version(env!("CARGO_PKG_VERSION"))
.arg_required_else_help(true)
.subcommands([
bootstrap::cli(),
echo::cli(),
r#false::cli(),
head::cli(),
hostname::cli(),
r#true::cli(),
])
.get_matches();
match matches.subcommand() {
Some(("echo", _matches)) => echo::run(),
Some(("false", _matches)) => r#false::run(),
Some(("head", matches)) => head::run(&matches),
Some(("hostname", matches)) => hostname::run(&matches),
Some(("true", _matches)) => r#true::run(),
_ => {}
}
}