Merge pull request #1015 from JasonLG1979/fix-v-with-equal

Fix --opt=value line argument logging
This commit is contained in:
Roderick van Domburg 2022-06-25 09:29:10 +02:00 committed by GitHub
commit 179cedaebe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -658,7 +658,15 @@ fn get_setup() -> Setup {
trace!("Command line argument(s):");
for (index, key) in args.iter().enumerate() {
let opt = key.trim_start_matches('-');
let opt = {
let key = key.trim_start_matches('-');
if let Some((s, _)) = key.split_once('=') {
s
} else {
key
}
};
if index > 0
&& key.starts_with('-')
@ -668,13 +676,13 @@ fn get_setup() -> Setup {
{
if matches!(opt, PASSWORD | PASSWORD_SHORT | USERNAME | USERNAME_SHORT) {
// Don't log creds.
trace!("\t\t{} \"XXXXXXXX\"", key);
trace!("\t\t{} \"XXXXXXXX\"", opt);
} else {
let value = matches.opt_str(opt).unwrap_or_else(|| "".to_string());
if value.is_empty() {
trace!("\t\t{}", key);
trace!("\t\t{}", opt);
} else {
trace!("\t\t{} \"{}\"", key, value);
trace!("\t\t{} \"{}\"", opt, value);
}
}
}