use clap::Parser;
use std::process;
#[derive(Parser, Debug)]
#[command(name = "prodigal-rs", version = "2.6.3")]
struct Cli {
#[arg(short = 'a')]
trans_file: Option<String>,
#[arg(short = 'c')]
closed: bool,
#[arg(short = 'd')]
nuc_file: Option<String>,
#[arg(short = 'f')]
output_format: Option<String>,
#[arg(short = 'g')]
trans_table: Option<String>,
#[arg(short = 'i')]
input_file: Option<String>,
#[arg(short = 'm')]
mask: bool,
#[arg(short = 'n')]
force_nonsd: bool,
#[arg(short = 'o')]
output_file: Option<String>,
#[arg(short = 'p')]
mode: Option<String>,
#[arg(short = 'q')]
quiet: bool,
#[arg(short = 's')]
start_file: Option<String>,
#[arg(short = 't')]
train_file: Option<String>,
}
fn main() {
let cli = Cli::parse();
let mut args: Vec<String> = vec!["prodigal".to_string()];
if let Some(ref f) = cli.trans_file {
args.push("-a".into());
args.push(f.clone());
}
if cli.closed {
args.push("-c".into());
}
if let Some(ref f) = cli.nuc_file {
args.push("-d".into());
args.push(f.clone());
}
if let Some(ref f) = cli.output_format {
args.push("-f".into());
args.push(f.clone());
}
if let Some(ref g) = cli.trans_table {
args.push("-g".into());
args.push(g.clone());
}
if let Some(ref f) = cli.input_file {
args.push("-i".into());
args.push(f.clone());
}
if cli.mask {
args.push("-m".into());
}
if cli.force_nonsd {
args.push("-n".into());
}
if let Some(ref f) = cli.output_file {
args.push("-o".into());
args.push(f.clone());
}
if let Some(ref p) = cli.mode {
args.push("-p".into());
args.push(p.clone());
}
if cli.quiet {
args.push("-q".into());
}
if let Some(ref f) = cli.start_file {
args.push("-s".into());
args.push(f.clone());
}
if let Some(ref f) = cli.train_file {
args.push("-t".into());
args.push(f.clone());
}
let rc = unsafe { prodigal_rs::pipeline::run_pipeline(&args) };
process::exit(rc);
}