From e9c44cbc0bbf0a790893122ab45da158fed541e7 Mon Sep 17 00:00:00 2001 From: Josh Holmer Date: Fri, 8 Apr 2016 09:01:32 -0400 Subject: [PATCH] Add `-s` as alias for `--strip safe` Fixes #31 --- CHANGELOG.md | 3 ++- README.md | 2 +- src/main.rs | 10 +++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index faf0b584..dfac8ec8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ -**Version 0.3.1 (unreleased)** +**Version 0.4.0 (unreleased)** - Performance optimizations + - [SEMVER_MAJOR] `-s` automatically infers `--strip safe` **Version 0.3.0** - Properly decode interlaced images diff --git a/README.md b/README.md index ed0872b8..e61e0210 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ More advanced options can be found by running `oxipng -h`. ## History 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 core goal of rewriting OptiPNG was to implement multithreading, diff --git a/src/main.rs b/src/main.rs index 0455ae46..90e241bb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -204,8 +204,12 @@ fn main() { .arg(Arg::with_name("strip") .help("Strip metadata objects ['safe', 'all', or comma-separated list]") .long("strip") + .takes_value(true) + .conflicts_with("strip-safe")) + .arg(Arg::with_name("strip-safe") + .help("Strip safely-removable metadata objects") .short("s") - .takes_value(true)) + .conflicts_with("strip")) .after_help("Optimization levels: -o 0 => --zc 3 --nz (0 or 1 trials) -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(()) }