diff --git a/tests/compress_and_decompress.rs b/tests/compress_and_decompress.rs index cd24b74..77d929d 100644 --- a/tests/compress_and_decompress.rs +++ b/tests/compress_and_decompress.rs @@ -7,7 +7,10 @@ use std::{ time::Duration, }; -use ouch::{cli::Command, commands::run, oof}; +use ouch::{ + cli::{Opts, Subcommand}, + commands::run, +}; use rand::{rngs::SmallRng, RngCore, SeedableRng}; use tempfile::NamedTempFile; use utils::*; @@ -172,11 +175,15 @@ fn extract_files(archive_path: &Path) -> Vec { // Add the suffix "results" extraction_output_folder.push("extraction_results"); - let command = Command::Decompress { - files: vec![archive_path.to_owned()], - output_folder: Some(extraction_output_folder.clone()), + let command = Opts { + yes: false, + no: false, + cmd: Subcommand::Decompress { + files: vec![archive_path.to_owned()], + output: Some(extraction_output_folder.clone()), + }, }; - run(command, &oof::Flags::default()).expect("Failed to extract"); + run(command, None).expect("Failed to extract"); fs::read_dir(extraction_output_folder).unwrap().map(Result::unwrap).map(|entry| entry.path()).collect() } diff --git a/tests/utils.rs b/tests/utils.rs index 05b4b0f..10cc749 100644 --- a/tests/utils.rs +++ b/tests/utils.rs @@ -7,7 +7,10 @@ use std::{ path::{Path, PathBuf}, }; -use ouch::{cli::Command, commands::run, oof}; +use ouch::{ + cli::{Opts, Subcommand}, + commands::run, +}; pub fn create_empty_dir(at: &Path, filename: &str) -> PathBuf { let dirname = Path::new(filename); @@ -22,8 +25,12 @@ pub fn compress_files(at: &Path, paths_to_compress: &[PathBuf], format: &str) -> let archive_path = String::from("archive.") + format; let archive_path = at.join(archive_path); - let command = Command::Compress { files: paths_to_compress.to_vec(), output_path: archive_path.clone() }; - run(command, &oof::Flags::default()).expect("Failed to compress test dummy files"); + let command = Opts { + yes: false, + no: false, + cmd: Subcommand::Compress { files: paths_to_compress.to_vec(), output: archive_path.clone() }, + }; + run(command, None).expect("Failed to compress test dummy files"); archive_path } @@ -40,11 +47,15 @@ pub fn extract_files(archive_path: &Path) -> Vec { // Add the suffix "results" extraction_output_folder.push("extraction_results"); - let command = Command::Decompress { - files: vec![archive_path.to_owned()], - output_folder: Some(extraction_output_folder.clone()), + let command = Opts { + yes: false, + no: false, + cmd: Subcommand::Decompress { + files: vec![archive_path.to_owned()], + output: Some(extraction_output_folder.clone()), + }, }; - run(command, &oof::Flags::default()).expect("Failed to extract"); + run(command, None).expect("Failed to extract"); fs::read_dir(extraction_output_folder).unwrap().map(Result::unwrap).map(|entry| entry.path()).collect() }