src/cli/mod.rs

//! Command-line interface.
//!
//! Sub-modules:
//!
//! - [`args`] — the top-level clap struct and shared flags.
//! - [`command`] — per-subcommand entry points (`tail`, `grep`, `json`, `bench`).
//! - [`shell_completion`] — completion script generation.

pub mod args;
pub mod command;
pub mod shell_completion;

pub use args::{Cli, Command};

use anyhow::Result;

pub async fn dispatch(cli: Cli) -> Result<()> {
    match cli.command {
        Command::Tail(args) => command::tail::run(args).await,
        Command::Grep(args) => command::grep::run(args).await,
        Command::Json(args) => command::json::run(args).await,
        Command::Bench(args) => command::bench::run(args).await,
        Command::Completions(args) => {
            shell_completion::print(args.shell, &mut std::io::stdout());
            Ok(())
        }
    }
}