use std::path::{Path, PathBuf};
use anyhow::Result;
#[enum_dispatch::enum_dispatch]
pub trait Command {
fn execute(&self) -> Result<()>;
}
#[must_use]
pub fn output_path(prefix: &Path, suffix: &str) -> PathBuf {
PathBuf::from(format!("{}{suffix}", prefix.to_string_lossy()))
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_output_path_simple() {
let result = output_path(Path::new("out/sample"), ".r1.fastq.gz");
assert_eq!(result, PathBuf::from("out/sample.r1.fastq.gz"));
}
#[test]
fn test_output_path_no_directory() {
let result = output_path(Path::new("prefix"), ".txt");
assert_eq!(result, PathBuf::from("prefix.txt"));
}
}