This repository has been archived on 2023-01-14. You can view files and clone it, but cannot push or open issues or pull requests.
toolkit/src/prereqs.rs

38 lines
728 B
Rust
Raw Normal View History

2022-12-17 21:51:41 +01:00
use clap::ArgMatches;
const DEPS: &[&str] = &["gh", "fzf"];
// -- List
//
pub fn ls() -> clap::Command {
clap::Command::new("ls")
}
pub fn ls_exec() -> eyre::Result<()> {
println!("Required packages\n---");
let mut deps: Vec<&str> = DEPS.into_iter().map(|d| d.clone()).collect();
deps.sort();
for dep in deps {
println!("{}", dep)
}
Ok(())
}
// -- Prereqs
//
pub fn prereqs() -> eyre::Result<clap::Command> {
let cmd = clap::Command::new("prereqs").subcommands([ls()]);
Ok(cmd)
}
pub fn prereqs_exec(matches: &ArgMatches) -> eyre::Result<()> {
match matches.subcommand() {
Some(("ls", _)) => ls_exec(),
_ => Err(eyre::anyhow!("not implemented")),
}
}