mirror of
https://github.com/Pagwin-Fedora/ppi.git
synced 2025-07-17 22:15:42 +00:00
made things mildly less effiecient so I could print pretty help
This commit is contained in:
parent
616049c7dc
commit
d254bbd4cd
2 changed files with 3 additions and 12 deletions
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "ppi"
|
||||
version = "1.1.0"
|
||||
version = "1.1.1"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
|
13
src/main.rs
13
src/main.rs
|
@ -68,16 +68,7 @@ fn main() -> Result<(),Errors> {
|
|||
.author(clap::crate_authors!())
|
||||
.subcommands(skeletons.keys().map(|v|Command::new(v).arg(Arg::new("output_dir").takes_value(true).action(clap::ArgAction::Append))))
|
||||
.subcommands(scripts.keys().map(|v|Command::new(v).arg(Arg::new("script_args").takes_value(true))));
|
||||
let mut short_help = String::new();
|
||||
let mut long_help = String::new();
|
||||
{
|
||||
let mut short_help_buf = Vec::new();
|
||||
let mut long_help_buf = Vec::new();
|
||||
program.write_help(&mut Cursor::new(&mut short_help_buf))?;
|
||||
program.write_help(&mut Cursor::new(&mut long_help_buf))?;
|
||||
short_help_buf.as_slice().read_to_string(&mut short_help)?;
|
||||
long_help_buf.as_slice().read_to_string(&mut long_help)?;
|
||||
}
|
||||
let mut prog_copy = program.clone();
|
||||
program.build();
|
||||
let matches = program.get_matches();
|
||||
for (skelly_name, (skelly_src, skelly_branch)) in skeletons {
|
||||
|
@ -177,7 +168,7 @@ fn main() -> Result<(),Errors> {
|
|||
std::process::exit(std::process::Command::new(script.1).args(sub.get_many::<String>("script_args").map(Iterator::collect).unwrap_or(Vec::new())).spawn()?.wait()?.code().ok_or(Errors::Unknown)?);
|
||||
}
|
||||
}
|
||||
println!("{}", short_help);
|
||||
prog_copy.print_help()?;
|
||||
Ok(())
|
||||
}
|
||||
#[derive(Debug)]
|
||||
|
|
Loading…
Reference in a new issue