use std::path::PathBuf;
use clap::Parser;
use crate::explain::Format;
use crate::pattern;
use crate::pulse::HeartbeatOpts;
#[derive(Parser, Debug)]
#[command(
name = "ct-view",
version,
about = "Show a file's lines by range, or the regions around a pattern with context.",
long_about = "ct-view is a focused, bounded reader for a single file (also reachable as \
`ct view`): print a line range with --range, or the windows around a \
--match pattern with --context lines, rather than dumping the whole file. \
See `ct-view --explain` for agent-oriented documentation."
)]
pub struct Cli {
pub path: PathBuf,
#[arg(long)]
pub range: Option<String>,
#[arg(long = "match")]
pub pattern: Option<String>,
#[arg(long, value_enum)]
pub mode: Option<pattern::Mode>,
#[arg(long, short = 'C', default_value_t = 2)]
pub context: usize,
#[arg(long)]
pub limit: Option<usize>,
#[arg(long, value_name = "SECS")]
pub timeout: Option<f64>,
#[command(flatten)]
pub heartbeat: HeartbeatOpts,
#[arg(long)]
pub plain: bool,
#[arg(long)]
pub json: bool,
#[arg(long)]
pub json_pretty: bool,
#[arg(long, value_enum, num_args = 0..=1, default_missing_value = "md")]
pub explain: Option<Format>,
}