hpk/src/bootstrap.rs

31 lines
994 B
Rust

use {
clap::{Arg, Command},
hpk::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::cli()).install(&outdir, arch, 1)?;
Ok(())
}