Skip to content

Commit 179ceda

Browse files
authored
Merge pull request #1015 from JasonLG1979/fix-v-with-equal
Fix --opt=value line argument logging
2 parents cbba7ab + 0db1797 commit 179ceda

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/main.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,15 @@ fn get_setup() -> Setup {
658658
trace!("Command line argument(s):");
659659

660660
for (index, key) in args.iter().enumerate() {
661-
let opt = key.trim_start_matches('-');
661+
let opt = {
662+
let key = key.trim_start_matches('-');
663+
664+
if let Some((s, _)) = key.split_once('=') {
665+
s
666+
} else {
667+
key
668+
}
669+
};
662670

663671
if index > 0
664672
&& key.starts_with('-')
@@ -668,13 +676,13 @@ fn get_setup() -> Setup {
668676
{
669677
if matches!(opt, PASSWORD | PASSWORD_SHORT | USERNAME | USERNAME_SHORT) {
670678
// Don't log creds.
671-
trace!("\t\t{} \"XXXXXXXX\"", key);
679+
trace!("\t\t{} \"XXXXXXXX\"", opt);
672680
} else {
673681
let value = matches.opt_str(opt).unwrap_or_else(|| "".to_string());
674682
if value.is_empty() {
675-
trace!("\t\t{}", key);
683+
trace!("\t\t{}", opt);
676684
} else {
677-
trace!("\t\t{} \"{}\"", key, value);
685+
trace!("\t\t{} \"{}\"", opt, value);
678686
}
679687
}
680688
}

0 commit comments

Comments
 (0)