mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Merge pull request #1015 from JasonLG1979/fix-v-with-equal
Fix --opt=value line argument logging
This commit is contained in:
commit
179cedaebe
1 changed files with 12 additions and 4 deletions
16
src/main.rs
16
src/main.rs
|
@ -658,7 +658,15 @@ fn get_setup() -> Setup {
|
||||||
trace!("Command line argument(s):");
|
trace!("Command line argument(s):");
|
||||||
|
|
||||||
for (index, key) in args.iter().enumerate() {
|
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
|
if index > 0
|
||||||
&& key.starts_with('-')
|
&& key.starts_with('-')
|
||||||
|
@ -668,13 +676,13 @@ fn get_setup() -> Setup {
|
||||||
{
|
{
|
||||||
if matches!(opt, PASSWORD | PASSWORD_SHORT | USERNAME | USERNAME_SHORT) {
|
if matches!(opt, PASSWORD | PASSWORD_SHORT | USERNAME | USERNAME_SHORT) {
|
||||||
// Don't log creds.
|
// Don't log creds.
|
||||||
trace!("\t\t{} \"XXXXXXXX\"", key);
|
trace!("\t\t{} \"XXXXXXXX\"", opt);
|
||||||
} else {
|
} else {
|
||||||
let value = matches.opt_str(opt).unwrap_or_else(|| "".to_string());
|
let value = matches.opt_str(opt).unwrap_or_else(|| "".to_string());
|
||||||
if value.is_empty() {
|
if value.is_empty() {
|
||||||
trace!("\t\t{}", key);
|
trace!("\t\t{}", opt);
|
||||||
} else {
|
} else {
|
||||||
trace!("\t\t{} \"{}\"", key, value);
|
trace!("\t\t{} \"{}\"", opt, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue