From d6054ba3eef7cc11a00afa7749fdc306c5acab83 Mon Sep 17 00:00:00 2001 From: figsoda Date: Thu, 21 Oct 2021 19:05:48 -0400 Subject: [PATCH] move QuestionPolicy to lib --- src/archive/tar.rs | 3 ++- src/archive/zip.rs | 3 ++- src/cli.rs | 3 +-- src/commands.rs | 6 ++---- src/lib.rs | 1 + tests/compress_and_decompress.rs | 2 +- tests/utils.rs | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/archive/tar.rs b/src/archive/tar.rs index bb52d7e..7106392 100644 --- a/src/archive/tar.rs +++ b/src/archive/tar.rs @@ -11,7 +11,8 @@ use walkdir::WalkDir; use crate::{ info, - utils::{self, Bytes, QuestionPolicy}, + utils::{self, Bytes}, + QuestionPolicy, }; pub fn unpack_archive( diff --git a/src/archive/zip.rs b/src/archive/zip.rs index 87d1a17..3cce681 100644 --- a/src/archive/zip.rs +++ b/src/archive/zip.rs @@ -11,7 +11,8 @@ use zip::{self, read::ZipFile, ZipArchive}; use crate::{ info, - utils::{self, dir_is_empty, strip_cur_dir, Bytes, QuestionPolicy}, + utils::{self, dir_is_empty, strip_cur_dir, Bytes}, + QuestionPolicy, }; use self::utf8::get_invalid_utf8_paths; diff --git a/src/cli.rs b/src/cli.rs index 256424b..7f57c14 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -7,8 +7,7 @@ use std::{ use clap::Parser; -pub use crate::utils::QuestionPolicy; -use crate::{Error, Opts, Subcommand}; +use crate::{Error, Opts, QuestionPolicy, Subcommand}; impl Opts { /// A helper method that calls `clap::Parser::parse` and then translates relative paths to absolute. diff --git a/src/commands.rs b/src/commands.rs index aa538a9..75de550 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -18,10 +18,8 @@ use crate::{ CompressionFormat::{self, *}, }, info, - utils::nice_directory_display, - utils::to_utf, - utils::{self, dir_is_empty, QuestionPolicy}, - Error, Opts, Subcommand, + utils::{self, dir_is_empty, nice_directory_display, to_utf}, + Error, Opts, QuestionPolicy, Subcommand, }; // Used in BufReader and BufWriter to perform less syscalls diff --git a/src/lib.rs b/src/lib.rs index d0650e0..c6f5a07 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,6 +19,7 @@ mod utils; pub use error::{Error, Result}; pub use opts::{Opts, Subcommand}; +pub use utils::QuestionPolicy; /// The status code ouch has when an error is encountered pub const EXIT_FAILURE: i32 = libc::EXIT_FAILURE; diff --git a/tests/compress_and_decompress.rs b/tests/compress_and_decompress.rs index d1344e9..6422953 100644 --- a/tests/compress_and_decompress.rs +++ b/tests/compress_and_decompress.rs @@ -7,7 +7,7 @@ use std::{ time::Duration, }; -use ouch::{cli::QuestionPolicy, commands::run, Opts, Subcommand}; +use ouch::{commands::run, Opts, QuestionPolicy, Subcommand}; use rand::{rngs::SmallRng, RngCore, SeedableRng}; use tempfile::NamedTempFile; use utils::*; diff --git a/tests/utils.rs b/tests/utils.rs index b51de5d..9ee7c7c 100644 --- a/tests/utils.rs +++ b/tests/utils.rs @@ -7,7 +7,7 @@ use std::{ path::{Path, PathBuf}, }; -use ouch::{cli::QuestionPolicy, commands::run, Opts, Subcommand}; +use ouch::{commands::run, Opts, QuestionPolicy, Subcommand}; pub fn create_empty_dir(at: &Path, filename: &str) -> PathBuf { let dirname = Path::new(filename);