use crate::{build_info, timed};
use anyhow::Result;
use clap::{Parser, Subcommand};
pub mod ess;
pub mod hyperball;
#[derive(Subcommand, Debug)]
#[command(name = "dist")]
pub enum SubCommands {
#[clap(name = "hyperball", visible_alias = "hb")]
HyperBall(hyperball::CliArgs),
#[clap(visible_alias = "ess")]
ExactSumSweep(ess::CliArgs),
}
#[derive(Parser, Debug)]
#[command(name = "webgraph-dist", version=build_info::version_string(), max_term_width = 100, after_help = include_str!("../common_env.txt"))]
pub struct Cli {
#[command(subcommand)]
command: SubCommands,
}
pub fn cli_main<I, T>(args: I) -> Result<()>
where
I: IntoIterator<Item = T>,
T: Into<std::ffi::OsString> + Clone,
{
timed(|| match Cli::parse_from(args).command {
SubCommands::HyperBall(args) => hyperball::main(args),
SubCommands::ExactSumSweep(args) => ess::main(args),
})
}