hpk/src/bootstrap.rs

40 lines
1.5 KiB
Rust

#![allow(dead_code)]
mod cli;
use {
clap::{Arg, Command},
cli::cli,
package_bootstrap::Bootstrap,
std::{error::Error, path::PathBuf},
};
fn main() -> Result<(), Box<dyn Error>> {
let matches = Command::new("bootstrap")
.about("install the software")
.author("Nathan Fisher")
.version(env!("CARGO_PKG_VERSION"))
.args([
Arg::new("arch")
.help("the architecture of the binary to be installed")
.short('a')
.long("arch")
.num_args(1),
Arg::new("output")
.help("the output directory for the installation")
.required(true)
.num_args(1),
])
.get_matches();
let outdir = matches.get_one::<String>("output").unwrap().to_string();
let outdir = PathBuf::from(&outdir);
let arch = matches.get_one::<String>("arch").map(|x| x.to_string());
Bootstrap::new("hpk", cli(), &outdir).install(arch, 8)?;
Bootstrap::new("hpk-init", cli::init(), &outdir).manpage(8)?;
Bootstrap::new("hpk-create", cli::create(), &outdir).manpage(8)?;
Bootstrap::new("hpk-install", cli::install(), &outdir).manpage(8)?;
Bootstrap::new("hpk-info", cli::info(), &outdir).manpage(8)?;
Bootstrap::new("hpk-search", cli::search(), &outdir).manpage(8)?;
Bootstrap::new("hpk-remove", cli::remove(), &outdir).manpage(8)?;
Bootstrap::new("hpk-upgrade", cli::upgrade(), &outdir).manpage(8)?;
Ok(())
}