mod argh_ext;
use argh::FromArgs;
use std::process::exit;
#[derive(Debug, FromArgs)]
#[allow(clippy::struct_excessive_bools)]
struct AppArgs {
#[argh(switch, short = 'b')]
branches: bool,
#[argh(option, short = 'p')]
path: Option<String>,
}
fn main() -> eyre::Result<()> {
let args: AppArgs = argh_ext::from_env();
let path = args.path.unwrap_or_else(|| ".".to_string());
let res = dg::run(path.as_str(), args.branches);
match res {
Ok(ok) => {
exit(i32::from(!ok));
}
Err(err) => {
eprintln!("error: {err}");
exit(1)
}
}
}