50 lines
1.6 KiB
Rust
50 lines
1.6 KiB
Rust
#![allow(dead_code)]
|
|
|
|
use std::path::Path;
|
|
|
|
use clap::ArgAction;
|
|
mod cli;
|
|
use {
|
|
clap::{Arg, Command},
|
|
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("meta")
|
|
.help("Install License and Readme files in doc subdirectory")
|
|
.short('m')
|
|
.long("meta")
|
|
.action(ArgAction::SetTrue),
|
|
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());
|
|
let bs = Bootstrap::new("haggis", cli::haggis(), &outdir);
|
|
bs.install(target_dir, 1)?;
|
|
if matches.get_flag("meta") {
|
|
bs.docfiles(&["README.md", "LICENSE.md"], &Path::new("haggis"))?;
|
|
}
|
|
Bootstrap::new("haggis-create", cli::create(), &outdir).manpage(1)?;
|
|
Bootstrap::new("haggis-extract", cli::extract(), &outdir).manpage(1)?;
|
|
Bootstrap::new("haggis-list", cli::list(), &outdir).manpage(1)?;
|
|
Ok(())
|
|
}
|