[GH-ISSUE #1011] Command line arguments aren't logged when using the --opt=value form #483

Closed
opened 2026-02-27 19:30:54 +03:00 by kerem · 3 comments
Owner

Originally created by @michaelherger on GitHub (Jun 5, 2022).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1011

I noticed some of my arguments were not logged when using --verbose. Trying to figure out what was causing this I realized that --opt=value would not be logged, while --opt value was. Yet the first form seems to be accepted just fine to pass an argument to the application.

Originally created by @michaelherger on GitHub (Jun 5, 2022). Original GitHub issue: https://github.com/librespot-org/librespot/issues/1011 I noticed some of my arguments were not logged when using `--verbose`. Trying to figure out what was causing this I realized that `--opt=value` would not be logged, while `--opt value` was. Yet the first form seems to be accepted just fine to pass an argument to the application.
kerem closed this issue 2026-02-27 19:30:54 +03:00
Author
Owner

@michaelherger commented on GitHub (Jun 5, 2022):

With the equal sign the password argument would not be listed (please ignore the -a param which is my own):

 % ./target/debug/spotty -n "yo!" -u "******" --password="********" -a --disable-discovery --verbose                
[2022-06-05T04:52:16Z INFO  spotty] spotty v1.3.0 - using librespot 0.4.1 c5b689f (Built on 2022-06-05, Build ID: hLVmRldx, Profile: debug)
[2022-06-05T04:52:16Z TRACE spotty] Command line argument(s):
[2022-06-05T04:52:16Z TRACE spotty] 		-n "yo!"
[2022-06-05T04:52:16Z TRACE spotty] 		-u "XXXXXXXX"
[2022-06-05T04:52:16Z TRACE spotty] 		-a
[2022-06-05T04:52:16Z TRACE spotty] 		--disable-discovery
[2022-06-05T04:52:16Z TRACE spotty] 		--verbose
[2022-06-05T04:52:16Z INFO  librespot_core::session] Connecting to AP "ap-gew1.spotify.com:4070"
[2022-06-05T04:52:16Z ERROR spotty] Connection failed: Login failed with reason: Bad credentials

Without the equal sign the password argument is listed:

% ./target/debug/spotty -n "yo!" -u "******" --password "********" -a --disable-discovery --verbose
[2022-06-05T04:52:21Z INFO  spotty] spotty v1.3.0 - using librespot 0.4.1 c5b689f (Built on 2022-06-05, Build ID: hLVmRldx, Profile: debug)
[2022-06-05T04:52:21Z TRACE spotty] Command line argument(s):
[2022-06-05T04:52:21Z TRACE spotty] 		-n "yo!"
[2022-06-05T04:52:21Z TRACE spotty] 		-u "XXXXXXXX"
[2022-06-05T04:52:21Z TRACE spotty] 		--password "XXXXXXXX"
[2022-06-05T04:52:21Z TRACE spotty] 		-a
[2022-06-05T04:52:21Z TRACE spotty] 		--disable-discovery
[2022-06-05T04:52:21Z TRACE spotty] 		--verbose
[2022-06-05T04:52:22Z INFO  librespot_core::session] Connecting to AP "ap-gew1.spotify.com:4070"
[2022-06-05T04:52:22Z ERROR spotty] Connection failed: Login failed with reason: Bad credentials

I guess that while iterating arguments in main.rs we'd need to split the key value by the = sign in case it didn't match any of the defined options. And then try again with the first part of the resulting tuple?

<!-- gh-comment-id:1146741812 --> @michaelherger commented on GitHub (Jun 5, 2022): With the equal sign the `password` argument would not be listed (please ignore the `-a` param which is my own): ``` % ./target/debug/spotty -n "yo!" -u "******" --password="********" -a --disable-discovery --verbose [2022-06-05T04:52:16Z INFO spotty] spotty v1.3.0 - using librespot 0.4.1 c5b689f (Built on 2022-06-05, Build ID: hLVmRldx, Profile: debug) [2022-06-05T04:52:16Z TRACE spotty] Command line argument(s): [2022-06-05T04:52:16Z TRACE spotty] -n "yo!" [2022-06-05T04:52:16Z TRACE spotty] -u "XXXXXXXX" [2022-06-05T04:52:16Z TRACE spotty] -a [2022-06-05T04:52:16Z TRACE spotty] --disable-discovery [2022-06-05T04:52:16Z TRACE spotty] --verbose [2022-06-05T04:52:16Z INFO librespot_core::session] Connecting to AP "ap-gew1.spotify.com:4070" [2022-06-05T04:52:16Z ERROR spotty] Connection failed: Login failed with reason: Bad credentials ``` Without the equal sign the `password` argument is listed: ``` % ./target/debug/spotty -n "yo!" -u "******" --password "********" -a --disable-discovery --verbose [2022-06-05T04:52:21Z INFO spotty] spotty v1.3.0 - using librespot 0.4.1 c5b689f (Built on 2022-06-05, Build ID: hLVmRldx, Profile: debug) [2022-06-05T04:52:21Z TRACE spotty] Command line argument(s): [2022-06-05T04:52:21Z TRACE spotty] -n "yo!" [2022-06-05T04:52:21Z TRACE spotty] -u "XXXXXXXX" [2022-06-05T04:52:21Z TRACE spotty] --password "XXXXXXXX" [2022-06-05T04:52:21Z TRACE spotty] -a [2022-06-05T04:52:21Z TRACE spotty] --disable-discovery [2022-06-05T04:52:21Z TRACE spotty] --verbose [2022-06-05T04:52:22Z INFO librespot_core::session] Connecting to AP "ap-gew1.spotify.com:4070" [2022-06-05T04:52:22Z ERROR spotty] Connection failed: Login failed with reason: Bad credentials ``` I guess that while iterating arguments in `main.rs` we'd need to split the `key` value by the `=` sign in case it didn't match any of the defined options. And then try again with the first part of the resulting tuple?
Author
Owner

@JasonLG1979 commented on GitHub (Jun 25, 2022):

Sorry I missed this issue. I believe I have a fix. The only side effect is that it also strips the - and -- from the log lines. So it would look like this:

[2022-06-25T05:11:48Z TRACE librespot] Command line argument(s):
[2022-06-25T05:11:48Z TRACE librespot] 		enable-volume-normalisation
[2022-06-25T05:11:48Z TRACE librespot] 		autoplay
[2022-06-25T05:11:48Z TRACE librespot] 		bitrate "320"
[2022-06-25T05:11:48Z TRACE librespot] 		format "S32"
[2022-06-25T05:11:48Z TRACE librespot] 		backend "subprocess"
[2022-06-25T05:11:48Z TRACE librespot] 		device "aplay -f S32_LE -r 44100 -c 2"
[2022-06-25T05:11:48Z TRACE librespot] 		v
<!-- gh-comment-id:1166196613 --> @JasonLG1979 commented on GitHub (Jun 25, 2022): Sorry I missed this issue. I believe I have a fix. The only side effect is that it also strips the `-` and `--` from the log lines. So it would look like this: ``` [2022-06-25T05:11:48Z TRACE librespot] Command line argument(s): [2022-06-25T05:11:48Z TRACE librespot] enable-volume-normalisation [2022-06-25T05:11:48Z TRACE librespot] autoplay [2022-06-25T05:11:48Z TRACE librespot] bitrate "320" [2022-06-25T05:11:48Z TRACE librespot] format "S32" [2022-06-25T05:11:48Z TRACE librespot] backend "subprocess" [2022-06-25T05:11:48Z TRACE librespot] device "aplay -f S32_LE -r 44100 -c 2" [2022-06-25T05:11:48Z TRACE librespot] v ```
Author
Owner

@michaelherger commented on GitHub (Jun 27, 2022):

Thanks, guys!

<!-- gh-comment-id:1166838331 --> @michaelherger commented on GitHub (Jun 27, 2022): Thanks, guys!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#483
No description provided.