summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-11-01 00:09:29 +0100
committerMatthias Beyer <mail@beyermatthias.de>2018-11-01 00:09:54 +0100
commite39bd7fc72ddf030d11206129c7e1c294a09a114 (patch)
treede4c6c8e4676b820e3a5ba9571cb2e7a6e3e9bea
parent1a1cc885cc4af51bec39bd0082ef3e1d0f9678f7 (diff)
parent25ee6f2ce427cc53a2d9f89ed74a854c4651189a (diff)
downloadimag-e39bd7fc72ddf030d11206129c7e1c294a09a114.zip
imag-e39bd7fc72ddf030d11206129c7e1c294a09a114.tar.gz
Merge branch 'fix-flag-forwarding'
Conflicts were handled manually. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--bin/core/imag/src/main.rs21
1 files changed, 14 insertions, 7 deletions
diff --git a/bin/core/imag/src/main.rs b/bin/core/imag/src/main.rs
index 1c469ec..55e4e6a 100644
--- a/bin/core/imag/src/main.rs
+++ b/bin/core/imag/src/main.rs
@@ -377,13 +377,20 @@ fn forward_commandline_arguments(m: &ArgMatches, scmd: &mut Vec<String>) {
debug!("Push({flag:?}, {val_name:?}, {matches:?}, {v:?}",
flag = flag, val_name = val_name, matches = m, v = v);
- let _ = m
- .value_of(val_name)
- .map(|val| {
- let flag = format!("--{}", flag.unwrap_or(val_name));
- v.insert(0, String::from(val));
- v.insert(0, flag);
- });
+ if m.is_present(val_name) {
+ let _ = m
+ .value_of(val_name)
+ .map(|val| {
+ debug!("Found '{:?}' = {:?}", val_name, val);
+ let flag = format!("--{}", flag.unwrap_or(val_name));
+ v.insert(0, String::from(val));
+ v.insert(0, flag);
+ })
+ .unwrap_or_else(|| {
+ let flag = format!("--{}", flag.unwrap_or(val_name));
+ v.insert(0, flag);
+ });
+ }
};
push(Some("verbose"),