use std::path::PathBuf;
use clap::Parser;
use crate::explain::Format;
use crate::pulse::HeartbeatOpts;
use crate::survey::{Depth, GroupKind, SortKey};
#[derive(Parser, Debug)]
#[command(
name = "ct-survey",
version,
about = "Survey a codebase by its build-system units: crates and modules, with file/line/test counts.",
long_about = "ct-survey reports a format-contextualized survey of a codebase (also reachable as \
`ct survey`): for Rust, the workspace -> crate -> module hierarchy, each element \
carrying file, line, and test counts. Crate identity, workspace membership, and \
cargo target kinds are authoritative (read from `cargo metadata`); file/line counts \
are exact; the module bucketing and the #[test] tally are heuristic (marked ~ in the \
output). With no --group, the contextual group type is inferred from the given path's \
Cargo.toml (a [workspace] table vs a lone [package]). See `ct-survey --explain` for \
agent-oriented documentation."
)]
pub struct Cli {
#[arg(default_value = ".")]
pub path: PathBuf,
#[arg(long, value_enum)]
pub group: Option<GroupKind>,
#[arg(long, value_enum, default_value_t = Depth::Module)]
pub depth: Depth,
#[arg(long, value_enum, default_value_t = SortKey::Name)]
pub sort: SortKey,
#[arg(long)]
pub json: bool,
#[arg(long)]
pub json_pretty: bool,
#[arg(long, value_name = "SECS")]
pub timeout: Option<f64>,
#[command(flatten)]
pub heartbeat: HeartbeatOpts,
#[arg(long, value_enum, num_args = 0..=1, default_missing_value = "md")]
pub explain: Option<Format>,
}