[librsvg/update-clap: 9/11] Fix the output option




commit f2772c765a04af360c2e7b5de4405dd66ae1b938
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Sep 20 11:46:56 2022 -0500

    Fix the output option
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/748>

 src/bin/rsvg-convert.rs | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/bin/rsvg-convert.rs b/src/bin/rsvg-convert.rs
index a3c7caa2d..7a37dbcfe 100644
--- a/src/bin/rsvg-convert.rs
+++ b/src/bin/rsvg-convert.rs
@@ -900,6 +900,7 @@ fn parse_args() -> Result<Converter, Error> {
             clap::Arg::with_name("output")
                 .short('o')
                 .long("output")
+                .takes_value(true)
                 .value_parser(clap::value_parser!(PathBuf))
                 .help("Output filename [defaults to stdout]"),
         )
@@ -1067,6 +1068,11 @@ fn parse_args() -> Result<Converter, Error> {
 
     let export_id: Option<String> = matches.get_one::<String>("export_id").map(lookup_id);
 
+    let output = match matches.get_one::<PathBuf>("output") {
+        None => Output::Stdout,
+        Some(path) => Output::Path(path.clone()),
+    };
+
     Ok(Converter {
         dpi_x,
         dpi_y,
@@ -1088,11 +1094,7 @@ fn parse_args() -> Result<Converter, Error> {
         keep_image_data,
         language,
         input,
-        output: matches
-            .get_one::<PathBuf>("output")
-            .cloned()
-            .map(Output::Path)
-            .unwrap_or(Output::Stdout),
+        output,
         testing: matches.is_present("testing"),
     })
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]