webgraph-cli 0.5.0

Command line interface for the Rust port of the WebGraph framework (http://webgraph.di.unimi.it/).
Documentation
/*
 * SPDX-FileCopyrightText: 2025 Tommaso Fontana
 * SPDX-FileCopyrightText: 2025 Sebastiano Vigna
 *
 * SPDX-License-Identifier: Apache-2.0 OR MIT
 */
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"))]
/// WebGraph tools computing graph properties based on distances.​
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),
    })
}