use std::path::PathBuf;
use clap::{Parser, Subcommand, ValueEnum};
#[derive(Parser)]
#[command(
name = "ds",
version,
about = "Fast offline document search — trigram + SimHash + structure",
long_about = None
)]
pub struct Cli {
#[command(subcommand)]
pub command: Command,
#[arg(long, global = true, default_value = "plain", value_enum)]
pub output: OutputFormat,
#[arg(long, global = true)]
pub index: Option<PathBuf>,
}
#[derive(Subcommand)]
pub enum Command {
Index {
path: PathBuf,
#[arg(long)]
full: bool,
},
Search {
query: String,
#[arg(short = 'n', long, default_value = "10")]
limit: usize,
#[arg(long, default_value = "120")]
context_size: usize,
#[arg(long)]
full_content: bool,
},
Query {
dsl: String,
#[arg(short = 'n', long, default_value = "10")]
limit: usize,
},
Similar {
file: PathBuf,
#[arg(long)]
threshold: Option<u32>,
#[arg(short = 'n', long, default_value = "10")]
limit: usize,
},
Recent {
#[arg(long, default_value = "7d")]
since: String,
#[arg(short = 'n', long, default_value = "20")]
limit: usize,
},
Mcp,
Clusters {
path: Option<PathBuf>,
#[arg(long, default_value = "4")]
bits: u32,
},
}
#[derive(Clone, ValueEnum)]
pub enum OutputFormat {
Plain,
Json,
Tsv,
}