mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 19:45:29 +00:00
move QuestionPolicy to lib
This commit is contained in:
parent
2816b837e2
commit
d6054ba3ee
@ -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(
|
||||||
|
@ -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;
|
||||||
|
@ -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.
|
||||||
|
@ -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
|
||||||
|
@ -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;
|
||||||
|
@ -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::*;
|
||||||
|
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user