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