use clap::{Args, Parser, Subcommand};
use clap_complete::Shell;
use crate::commands::alert::AlertCommand;
use crate::commands::market::MarketCommand;
use crate::commands::report::ReportCommand;
use crate::commands::trade::TradeCommand;
use crate::commands::volume::VolumeCommand;
use crate::commands::watchlist::WatchlistCommand;
#[derive(Debug, Parser)]
#[command(
name = "volumeleaders-agent",
version,
about = "CLI tool for querying VolumeLeaders institutional trade data",
long_about = "volumeleaders-agent queries institutional trade data from VolumeLeaders.\n\n\
Use it for trades, volume leaderboards, market data, alerts, and watchlists.\n\n\
Auth: reads browser cookies automatically. If auth fails with exit code 2,\n\
log in at https://www.volumeleaders.com in your browser, then retry.\n\n\
Output: compact JSON to stdout. Pipe through jq for pretty-printing.\n\
Errors and logs go to stderr.",
arg_required_else_help = true,
propagate_version = true
)]
pub struct Cli {
#[arg(long, global = true)]
pub json_table: bool,
#[arg(short, long, global = true, hide = true)]
pub json: bool,
#[command(subcommand)]
pub command: Commands,
}
#[derive(Debug, Subcommand)]
#[allow(clippy::large_enum_variant)]
pub enum Commands {
Report(ReportArgs),
Trade(TradeArgs),
Volume(VolumeArgs),
Market(MarketArgs),
Alert(AlertArgs),
Watchlist(WatchlistArgs),
Completions(CompletionsArgs),
}
#[derive(Debug, Args)]
pub struct ReportArgs {
#[command(subcommand)]
pub command: ReportCommand,
}
#[derive(Debug, Args)]
pub struct TradeArgs {
#[command(subcommand)]
pub command: TradeCommand,
}
#[derive(Debug, Args)]
pub struct VolumeArgs {
#[command(subcommand)]
pub command: VolumeCommand,
}
#[derive(Debug, Args)]
pub struct MarketArgs {
#[command(subcommand)]
pub command: MarketCommand,
}
#[derive(Debug, Args)]
pub struct AlertArgs {
#[command(subcommand)]
pub command: AlertCommand,
}
#[derive(Debug, Args)]
pub struct WatchlistArgs {
#[command(subcommand)]
pub command: WatchlistCommand,
}
#[derive(Debug, Args)]
pub struct CompletionsArgs {
pub shell: Shell,
}
#[cfg(test)]
mod tests {
use clap::CommandFactory;
use super::Cli;
#[test]
fn command_tree_is_valid() {
Cli::command().debug_assert();
}
}