mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +00:00
implement --fast
and --slow
This commit is contained in:
parent
e0391a872b
commit
f21883170b
@ -61,8 +61,18 @@ pub enum Subcommand {
|
|||||||
output: PathBuf,
|
output: PathBuf,
|
||||||
|
|
||||||
/// Compression level, applied to all formats
|
/// Compression level, applied to all formats
|
||||||
#[arg(short, long)]
|
#[arg(short, long, group = "compression-level")]
|
||||||
level: Option<i16>,
|
level: Option<i16>,
|
||||||
|
|
||||||
|
/// Fastest compression level possible,
|
||||||
|
/// conflicts with --level and --slow
|
||||||
|
#[arg(long, group = "compression-level")]
|
||||||
|
fast: bool,
|
||||||
|
|
||||||
|
/// Slowest (and best) compression level possible,
|
||||||
|
/// conflicts with --level and --fast
|
||||||
|
#[arg(long, group = "compression-level")]
|
||||||
|
slow: bool,
|
||||||
},
|
},
|
||||||
/// Decompresses one or more files, optionally into another folder
|
/// Decompresses one or more files, optionally into another folder
|
||||||
#[command(visible_alias = "d")]
|
#[command(visible_alias = "d")]
|
||||||
|
@ -45,6 +45,8 @@ pub fn run(
|
|||||||
files,
|
files,
|
||||||
output: output_path,
|
output: output_path,
|
||||||
level,
|
level,
|
||||||
|
fast,
|
||||||
|
slow,
|
||||||
} => {
|
} => {
|
||||||
// After cleaning, if there are no input files left, exit
|
// After cleaning, if there are no input files left, exit
|
||||||
if files.is_empty() {
|
if files.is_empty() {
|
||||||
@ -81,7 +83,13 @@ pub fn run(
|
|||||||
args.quiet,
|
args.quiet,
|
||||||
question_policy,
|
question_policy,
|
||||||
file_visibility_policy,
|
file_visibility_policy,
|
||||||
level,
|
if fast {
|
||||||
|
Some(0)
|
||||||
|
} else if slow {
|
||||||
|
Some(i16::MAX)
|
||||||
|
} else {
|
||||||
|
level
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Ok(true) = compress_result {
|
if let Ok(true) = compress_result {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user