use crate::output::Compression;
use clap::Parser;
use super::{FilterOptions, InputOptions, RuntimeOptions};
#[derive(Parser, Debug)]
pub struct DumpArgs {
#[clap(flatten)]
pub input: InputOptions,
#[clap(flatten)]
pub filter: FilterOptions,
#[clap(flatten)]
pub output: DumpOutput,
#[clap(flatten)]
pub runtime: RuntimeOptions,
}
#[derive(Parser, Debug)]
#[clap(next_help_heading = "OUTPUT OPTIONS")]
pub struct DumpOutput {
#[clap(short = 'o', long, default_value = "output")]
pub outdir: String,
#[clap(short = 'n', long, requires = "split")]
pub named_pipes: bool,
#[clap(short = 'f', long, default_value = "q")]
pub format: OutputFormat,
#[clap(short = 's', long)]
pub split: bool,
#[clap(short = 'p', long, default_value = "seg_")]
pub prefix: String,
#[clap(long, requires = "split")]
pub include_sid: bool,
#[clap(short = 'c', long, default_value = "u")]
pub compression: Compression,
#[clap(short = 'E', long)]
pub keep_empty: bool,
}
impl DumpOutput {
pub fn include_sid(&self) -> bool {
if self.split {
self.include_sid
} else {
true
}
}
}
#[derive(clap::ValueEnum, Clone, Copy, Debug)]
pub enum OutputFormat {
#[clap(name = "q", help = "FASTQ")]
Fastq,
#[clap(name = "a", help = "FASTA")]
Fasta,
}
impl OutputFormat {
pub fn ext(&self) -> &str {
match self {
Self::Fasta => "fa",
Self::Fastq => "fq",
}
}
}