SNZ3OAMCPUGFYON5SZHQQQK46ZZMVMJECJYEUCMG657UVLY2PNBQC
BQDE4VH6OZHULHAOP37GSBJMCI5QIFSOU6COBYKPAY6FPH3IMISAC
NV6OSWDHKDVMX7V24S5MZ4SOIHC3JW4CP7PD2AYKQBXIKVRZKVYAC
L4JXJHWXYNCL4QGJXNKKTOKKTAXKKXBJUUY7HFZGEUZ5A2V5H34QC
SXEYMYF7P4RZMZ46WPL4IZUTSQ2ATBWYZX7QNVMS3SGOYXYOHAGQC
WXAFKN6JL3LRIRTTW2Q7UQIZBZSAHYIUVTPWKMK2GK2W3GZ44XHAC
RJMQSZER3DDPF7ANVKDPMR3KZZ7DKM5ASAOVPBQBAPDLJNL6BJ5AC
GURIBVW66JDQK3SJZRGVJ2MQLMT7JD4KLI5QPQZGPAL7WH3T6T4AC
match external_command() {
Ok(false) => {
let opts = Opts::parse();
if let Err(e) = run(opts).await {
writeln!(std::io::stderr(), "Error: {}", e).unwrap_or(());
std::process::exit(1);
}
}
Ok(true) => (),
Err((cmd, e)) => {
writeln!(
std::io::stderr(),
"Error while trying to run {:?}: {}",
cmd,
e
)
.unwrap_or(());
}
}
std::process::exit(0);
}
let opts = Opts::parse();
fn external_command() -> Result<bool, (String, std::io::Error)> {
let mut cmd = String::new();
let mut args = Vec::new();
use clap::IntoApp;
let app = Opts::into_app();
for arg in std::env::args().skip(1) {
if cmd.is_empty() {
if arg == "help"
|| arg.starts_with("--")
|| app
.get_subcommands()
.any(|sub| sub.get_name() == arg || sub.get_all_aliases().any(|al| al == arg))
{
return Ok(false);
}
cmd.push_str("pijul-");
cmd.push_str(&arg)
} else {
args.push(arg)
}
}
if cmd.is_empty() {
return Ok(false);
}
if let Err(e) = run_external_command(&cmd, &args) {
Err((cmd, e))
if let Err(e) = run(opts).await {
writeln!(std::io::stderr(), "Error: {}", e).unwrap_or(());
std::process::exit(1);