move QuestionPolicy to lib

This commit is contained in:
figsoda 2021-10-21 19:05:48 -04:00
parent 2816b837e2
commit d6054ba3ee
7 changed files with 10 additions and 10 deletions

View File

@ -11,7 +11,8 @@ use walkdir::WalkDir;
use crate::{ use crate::{
info, info,
utils::{self, Bytes, QuestionPolicy}, utils::{self, Bytes},
QuestionPolicy,
}; };
pub fn unpack_archive( pub fn unpack_archive(

View File

@ -11,7 +11,8 @@ use zip::{self, read::ZipFile, ZipArchive};
use crate::{ use crate::{
info, 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; use self::utf8::get_invalid_utf8_paths;

View File

@ -7,8 +7,7 @@ use std::{
use clap::Parser; use clap::Parser;
pub use crate::utils::QuestionPolicy; use crate::{Error, Opts, QuestionPolicy, Subcommand};
use crate::{Error, Opts, Subcommand};
impl Opts { impl Opts {
/// A helper method that calls `clap::Parser::parse` and then translates relative paths to absolute. /// A helper method that calls `clap::Parser::parse` and then translates relative paths to absolute.

View File

@ -18,10 +18,8 @@ use crate::{
CompressionFormat::{self, *}, CompressionFormat::{self, *},
}, },
info, info,
utils::nice_directory_display, utils::{self, dir_is_empty, nice_directory_display, to_utf},
utils::to_utf, Error, Opts, QuestionPolicy, Subcommand,
utils::{self, dir_is_empty, QuestionPolicy},
Error, Opts, Subcommand,
}; };
// Used in BufReader and BufWriter to perform less syscalls // Used in BufReader and BufWriter to perform less syscalls

View File

@ -19,6 +19,7 @@ mod utils;
pub use error::{Error, Result}; pub use error::{Error, Result};
pub use opts::{Opts, Subcommand}; pub use opts::{Opts, Subcommand};
pub use utils::QuestionPolicy;
/// The status code ouch has when an error is encountered /// The status code ouch has when an error is encountered
pub const EXIT_FAILURE: i32 = libc::EXIT_FAILURE; pub const EXIT_FAILURE: i32 = libc::EXIT_FAILURE;

View File

@ -7,7 +7,7 @@ use std::{
time::Duration, time::Duration,
}; };
use ouch::{cli::QuestionPolicy, commands::run, Opts, Subcommand}; use ouch::{commands::run, Opts, QuestionPolicy, Subcommand};
use rand::{rngs::SmallRng, RngCore, SeedableRng}; use rand::{rngs::SmallRng, RngCore, SeedableRng};
use tempfile::NamedTempFile; use tempfile::NamedTempFile;
use utils::*; use utils::*;

View File

@ -7,7 +7,7 @@ use std::{
path::{Path, PathBuf}, 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 { pub fn create_empty_dir(at: &Path, filename: &str) -> PathBuf {
let dirname = Path::new(filename); let dirname = Path::new(filename);