Skip to main content

cyto_cli/
output.rs

1use std::path::PathBuf;
2
3use anyhow::Result;
4use clap::Parser;
5use cyto_io::validate_output_directory;
6
7#[derive(Parser, Debug)]
8#[clap(next_help_heading = "Output Options")]
9pub struct ArgsOutput {
10    /// Output directory path
11    #[clap(short = 'o', long, default_value = "./cyto_out")]
12    pub outdir: String,
13
14    /// Force overwrite of existing output directory
15    #[clap(short = 'f', long)]
16    pub force: bool,
17
18    /// Minimum number of records required to keep an IBU file
19    ///
20    /// IBU files with fewer records than this threshold will be removed.
21    /// A value of 0 or 1 will cause only empty IBU files (those with 0 records) to be removed.
22    ///
23    /// This is useful when you have a large number of possible probes but are only expecting a smaller number of observed probes.
24    /// If you want to specify probes see the `--probe-regex` flag.
25    #[clap(long, default_value_t = 1_000)]
26    pub min_ibu_records: u64,
27}
28impl ArgsOutput {
29    pub fn validate_outdir(&self) -> Result<()> {
30        validate_output_directory(&self.outdir, self.force)
31    }
32    pub fn log_path(&self) -> PathBuf {
33        PathBuf::from(&self.outdir).join("cyto.log")
34    }
35}