summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukáš Tyrychtr <lukastyrychtr@gmail.com>2022-10-21 09:07:54 +0200
committerFederico Mena Quintero <federico@gnome.org>2022-11-04 14:14:38 -0600
commitb3c6a4b0e11962acdd9fb4b1c71c076613737cfe (patch)
tree2482ccea267afa46981a855abf02879d7687626c
parent8a1319d26f7c88f31a0bb462b3fffa6ff0be14f3 (diff)
downloadlibrsvg-b3c6a4b0e11962acdd9fb4b1c71c076613737cfe.tar.gz
Fix handling of flags
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/765>
-rw-r--r--src/bin/rsvg-convert.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/bin/rsvg-convert.rs b/src/bin/rsvg-convert.rs
index a69ad91b..54d8c958 100644
--- a/src/bin/rsvg-convert.rs
+++ b/src/bin/rsvg-convert.rs
@@ -790,7 +790,6 @@ fn parse_args() -> Result<Converter, Error> {
.disable_help_flag(true)
.arg(
clap::Arg::new("help")
- .short('h')
.short('?')
.long("help")
.help("Display the help")
@@ -990,13 +989,15 @@ fn parse_args() -> Result<Converter, Error> {
clap::Arg::new("keep_image_data")
.long("keep-image-data")
.help("Keep image data")
+ .conflicts_with("no_keep_image_data")
.action(clap::ArgAction::SetTrue),
)
.arg(
clap::Arg::new("no_keep_image_data")
.long("no-keep-image-data")
.help("Do not keep image data")
- .action(clap::ArgAction::SetFalse),
+ .conflicts_with("keep_image_data")
+ .action(clap::ArgAction::SetTrue),
)
.arg(
clap::Arg::new("testing")
@@ -1030,8 +1031,8 @@ fn parse_args() -> Result<Converter, Error> {
};
let keep_image_data = match format {
- Format::Ps | Format::Eps | Format::Pdf => !matches.contains_id("no_keep_image_data"),
- _ => matches.contains_id("keep_image_data"),
+ Format::Ps | Format::Eps | Format::Pdf => !matches.get_flag("no_keep_image_data"),
+ _ => matches.get_flag("keep_image_data"),
};
let language = match matches.get_one::<String>("accept-language") {
@@ -1127,10 +1128,10 @@ fn parse_args() -> Result<Converter, Error> {
page_size,
format,
export_id,
- keep_aspect_ratio: matches.contains_id("keep_aspect"),
+ keep_aspect_ratio: matches.get_flag("keep_aspect"),
background_color,
stylesheet: matches.get_one("stylesheet").cloned(),
- unlimited: matches.contains_id("unlimited"),
+ unlimited: matches.get_flag("unlimited"),
keep_image_data,
language,
input,