hpk/src/bootstrap.rs
2023-05-07 22:05:57 -04:00

42 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("target-dir")
.help("the directory where the 'hpk' binary is located")
.short('t')
.long("target-dir")
.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 target_dir = matches
.get_one::<String>("target-dir")
.map(|x| x.to_string());
Bootstrap::new("hpk", cli(), &outdir).install(target_dir, 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(())
}