Merge branch 'master' into log

This commit is contained in:
Josh Holmer 2020-04-18 18:20:42 -04:00 committed by GitHub
commit 93f876cb79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -148,7 +148,8 @@ fn main() {
Ok(_) => Ok(()), Ok(_) => Ok(()),
Err(_) => Err("Invalid option for compression".to_owned()), Err(_) => Err("Invalid option for compression".to_owned()),
} }
})) })
.conflicts_with_all(&["zopfli", "libdeflater"]))
.arg(Arg::with_name("strategies") .arg(Arg::with_name("strategies")
.help("zlib compression strategies (0-3) - Default: 0-3") .help("zlib compression strategies (0-3) - Default: 0-3")
.long("zs") .long("zs")
@ -158,7 +159,8 @@ fn main() {
Ok(_) => Ok(()), Ok(_) => Ok(()),
Err(_) => Err("Invalid option for strategies".to_owned()), Err(_) => Err("Invalid option for strategies".to_owned()),
} }
})) })
.conflicts_with_all(&["zopfli", "libdeflater"]))
.arg(Arg::with_name("window") .arg(Arg::with_name("window")
.help("zlib window size - Default: 32k") .help("zlib window size - Default: 32k")
.long("zw") .long("zw")
@ -171,7 +173,8 @@ fn main() {
.possible_value("4k") .possible_value("4k")
.possible_value("8k") .possible_value("8k")
.possible_value("16k") .possible_value("16k")
.possible_value("32k")) .possible_value("32k")
.conflicts_with_all(&["zopfli", "libdeflater"]))
.arg(Arg::with_name("no-bit-reduction") .arg(Arg::with_name("no-bit-reduction")
.help("No bit depth reduction") .help("No bit depth reduction")
.long("nb")) .long("nb"))
@ -193,11 +196,13 @@ fn main() {
.arg(Arg::with_name("zopfli") .arg(Arg::with_name("zopfli")
.help("Use the slower but better compressing Zopfli algorithm, overrides zlib-specific options") .help("Use the slower but better compressing Zopfli algorithm, overrides zlib-specific options")
.short("Z") .short("Z")
.long("zopfli")) .long("zopfli")
.conflicts_with("libdeflater"))
.arg(Arg::with_name("libdeflater") .arg(Arg::with_name("libdeflater")
.help("Use an alternative Libdeflater algorithm, overrides zlib-specific options") .help("Use an alternative Libdeflater algorithm, overrides zlib-specific options")
.short("D") .short("D")
.long("libdeflater")) .long("libdeflater")
.conflicts_with("zopfli"))
.arg(Arg::with_name("timeout") .arg(Arg::with_name("timeout")
.help("Maximum amount of time, in seconds, to spend on optimizations") .help("Maximum amount of time, in seconds, to spend on optimizations")
.takes_value(true) .takes_value(true)
@ -460,16 +465,9 @@ fn parse_opts_into_struct(
if matches.is_present("zopfli") { if matches.is_present("zopfli") {
opts.deflate = Deflaters::Zopfli; opts.deflate = Deflaters::Zopfli;
} } else if matches.is_present("libdeflater") {
if matches.is_present("libdeflater") {
if matches.is_present("zopfli") {
return Err("zopfli and libdeflater can't be used simultaneously".to_owned());
}
opts.deflate = Deflaters::Libdeflater; opts.deflate = Deflaters::Libdeflater;
} } else if let Deflaters::Zlib {
if let Deflaters::Zlib {
compression, compression,
strategies, strategies,
window, window,
@ -494,13 +492,6 @@ fn parse_opts_into_struct(
// 32k is default // 32k is default
_ => (), _ => (),
} }
} else if matches.is_present("compression")
|| matches.is_present("strategies")
|| matches.is_present("window")
{
return Err(
"compression, strategies and window options are compatible only with zlib".to_owned(),
);
} }
if let Some(x) = matches.value_of("threads") { if let Some(x) = matches.value_of("threads") {