2020-02-08 19:36:00 +00:00
|
|
|
// Hi, future me (or whoever you are)!
|
|
|
|
//
|
|
|
|
// Yes, we do need this attr.
|
|
|
|
// No, the warnings cannot be fixed otherwise.
|
|
|
|
// Accept and endure. Do not touch.
|
|
|
|
#![allow(unused)]
|
|
|
|
|
2020-06-19 00:49:33 +00:00
|
|
|
use clap::IntoApp;
|
2020-01-07 10:17:23 +00:00
|
|
|
|
|
|
|
pub fn get_help<T: IntoApp>() -> String {
|
|
|
|
let mut output = Vec::new();
|
2020-01-31 09:13:44 +00:00
|
|
|
<T as IntoApp>::into_app().write_help(&mut output).unwrap();
|
2020-01-07 10:17:23 +00:00
|
|
|
let output = String::from_utf8(output).unwrap();
|
|
|
|
|
|
|
|
eprintln!("\n%%% HELP %%%:=====\n{}\n=====\n", output);
|
|
|
|
eprintln!("\n%%% HELP (DEBUG) %%%:=====\n{:?}\n=====\n", output);
|
|
|
|
|
|
|
|
output
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_long_help<T: IntoApp>() -> String {
|
|
|
|
let mut output = Vec::new();
|
|
|
|
<T as IntoApp>::into_app()
|
|
|
|
.write_long_help(&mut output)
|
|
|
|
.unwrap();
|
|
|
|
let output = String::from_utf8(output).unwrap();
|
|
|
|
|
|
|
|
eprintln!("\n%%% LONG_HELP %%%:=====\n{}\n=====\n", output);
|
|
|
|
eprintln!("\n%%% LONG_HELP (DEBUG) %%%:=====\n{:?}\n=====\n", output);
|
|
|
|
|
|
|
|
output
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_subcommand_long_help<T: IntoApp>(subcmd: &str) -> String {
|
2020-04-12 01:39:13 +00:00
|
|
|
let mut output = Vec::new();
|
2020-06-19 00:49:33 +00:00
|
|
|
<T as IntoApp>::into_app()
|
2020-07-06 14:26:53 +00:00
|
|
|
.get_subcommands_mut()
|
|
|
|
.find(|s| s.get_name() == subcmd)
|
2020-04-12 01:39:13 +00:00
|
|
|
.unwrap()
|
|
|
|
.write_long_help(&mut output)
|
|
|
|
.unwrap();
|
|
|
|
let output = String::from_utf8(output).unwrap();
|
2020-01-07 10:17:23 +00:00
|
|
|
|
|
|
|
eprintln!(
|
|
|
|
"\n%%% SUBCOMMAND `{}` HELP %%%:=====\n{}\n=====\n",
|
|
|
|
subcmd, output
|
|
|
|
);
|
|
|
|
eprintln!(
|
|
|
|
"\n%%% SUBCOMMAND `{}` HELP (DEBUG) %%%:=====\n{:?}\n=====\n",
|
|
|
|
subcmd, output
|
|
|
|
);
|
|
|
|
|
|
|
|
output
|
|
|
|
}
|