Add -s as alias for --strip safe

Fixes #31
This commit is contained in:
Josh Holmer 2016-04-08 09:01:32 -04:00 committed by Joshua Holmer
parent cf9fc98047
commit e9c44cbc0b
3 changed files with 12 additions and 3 deletions

View file

@ -1,5 +1,6 @@
**Version 0.3.1 (unreleased)** **Version 0.4.0 (unreleased)**
- Performance optimizations - Performance optimizations
- [SEMVER_MAJOR] `-s` automatically infers `--strip safe`
**Version 0.3.0** **Version 0.3.0**
- Properly decode interlaced images - Properly decode interlaced images

View file

@ -67,7 +67,7 @@ More advanced options can be found by running `oxipng -h`.
## History ## History
Oxipng began as a complete rewrite of the OptiPNG project, Oxipng began as a complete rewrite of the OptiPNG project,
which is assumed to be dead as no commit has been made to it since March 2014. which was assumed to be dead as no commit had been made to it since March 2014.
The name has been changed to avoid confusion and potential legal issues. The name has been changed to avoid confusion and potential legal issues.
The core goal of rewriting OptiPNG was to implement multithreading, The core goal of rewriting OptiPNG was to implement multithreading,

View file

@ -204,8 +204,12 @@ fn main() {
.arg(Arg::with_name("strip") .arg(Arg::with_name("strip")
.help("Strip metadata objects ['safe', 'all', or comma-separated list]") .help("Strip metadata objects ['safe', 'all', or comma-separated list]")
.long("strip") .long("strip")
.takes_value(true)
.conflicts_with("strip-safe"))
.arg(Arg::with_name("strip-safe")
.help("Strip safely-removable metadata objects")
.short("s") .short("s")
.takes_value(true)) .conflicts_with("strip"))
.after_help("Optimization levels: .after_help("Optimization levels:
-o 0 => --zc 3 --nz (0 or 1 trials) -o 0 => --zc 3 --nz (0 or 1 trials)
-o 1 => --zc 9 (1 trial, determined heuristically) -o 1 => --zc 9 (1 trial, determined heuristically)
@ -504,6 +508,10 @@ fn parse_opts_into_struct(matches: &ArgMatches, opts: &mut oxipng::Options) -> R
} }
} }
if matches.is_present("strip-safe") {
opts.strip = png::Headers::Safe;
}
Ok(()) Ok(())
} }