use anyhow::Result;
use clap::{Command, Parser, Subcommand};
use clap_complete::shells::Shell;
pub mod dcf;
pub mod ef;
pub mod offsets;
#[derive(Subcommand, Debug)]
#[command(name = "build")]
pub enum SubCommands {
Ef(ef::CliArgs),
Dcf(dcf::CliArgs),
Offsets(offsets::CliArgs),
Complete(CompleteArgs),
}
#[derive(Parser, Debug)]
#[command(next_line_help = true)]
pub struct CompleteArgs {
shell: Shell,
}
pub fn main(subcommand: SubCommands, mut top_command: Command) -> Result<()> {
match subcommand {
SubCommands::Ef(args) => ef::main(args),
SubCommands::Dcf(args) => dcf::main(args),
SubCommands::Offsets(args) => offsets::main(args),
SubCommands::Complete(args) => {
clap_complete::generate(
args.shell,
&mut top_command,
"webgraph",
&mut std::io::stdout(),
);
Ok(())
}
}
}