Skip to main content

webgraph_cli/dist/
mod.rs

1/*
2 * SPDX-FileCopyrightText: 2025 Tommaso Fontana
3 * SPDX-FileCopyrightText: 2025 Sebastiano Vigna
4 *
5 * SPDX-License-Identifier: Apache-2.0 OR MIT
6 */
7use crate::{build_info, timed};
8use anyhow::Result;
9use clap::{Parser, Subcommand};
10
11pub mod ess;
12pub mod hyperball;
13
14#[derive(Subcommand, Debug)]
15#[command(name = "dist")]
16pub enum SubCommands {
17    #[clap(name = "hyperball", visible_alias = "hb")]
18    HyperBall(hyperball::CliArgs),
19    #[clap(visible_alias = "ess")]
20    ExactSumSweep(ess::CliArgs),
21}
22
23#[derive(Parser, Debug)]
24#[command(name = "webgraph-dist", version=build_info::version_string(), max_term_width = 100, after_help = include_str!("../common_env.txt"))]
25/// WebGraph tools computing graph properties based on distances.​
26pub struct Cli {
27    #[command(subcommand)]
28    command: SubCommands,
29}
30
31pub fn cli_main<I, T>(args: I) -> Result<()>
32where
33    I: IntoIterator<Item = T>,
34    T: Into<std::ffi::OsString> + Clone,
35{
36    timed(|| match Cli::parse_from(args).command {
37        SubCommands::HyperBall(args) => hyperball::main(args),
38        SubCommands::ExactSumSweep(args) => ess::main(args),
39    })
40}