use clap::Args;
use llmcc_dot::ComponentDepth;
#[derive(Args, Debug, Clone, Default)]
pub struct GraphOptions {
#[arg(long = "component-depth", default_value = "3")]
component_depth_num: usize,
#[arg(long = "pagerank-top-k")]
pub pagerank_top_k: Option<usize>,
#[arg(long = "arch-graph")]
pub architecture_graph: bool,
#[arg(long = "cluster-by-crate")]
pub cluster_by_crate: bool,
#[arg(long = "short-labels")]
pub short_labels: bool,
}
impl GraphOptions {
pub fn component_depth(&self) -> ComponentDepth {
ComponentDepth::from_number(self.component_depth_num)
}
}
#[derive(Args, Debug, Clone, Default)]
pub struct ProcessingOptions {
#[arg(long)]
pub parallel: bool,
#[arg(long = "print-ir", default_value = "false")]
pub print_ir: bool,
}
#[derive(Args, Debug, Clone, Default)]
pub struct CommonTestOptions {
#[command(flatten)]
pub graph: GraphOptions,
#[command(flatten)]
pub processing: ProcessingOptions,
#[arg(long = "keep-temps")]
pub keep_temps: bool,
#[arg(long)]
pub update: bool,
}
impl GraphOptions {
pub fn new() -> Self {
Self::default()
}
pub fn with_component_depth(mut self, depth: ComponentDepth) -> Self {
self.component_depth_num = depth.as_number();
self
}
pub fn with_pagerank_top_k(mut self, top_k: Option<usize>) -> Self {
self.pagerank_top_k = top_k;
self
}
}
impl ProcessingOptions {
pub fn new() -> Self {
Self::default()
}
pub fn with_parallel(mut self, parallel: bool) -> Self {
self.parallel = parallel;
self
}
pub fn with_print_ir(mut self, print_ir: bool) -> Self {
self.print_ir = print_ir;
self
}
}