[PR #966] [MERGED] Only log runtime argument if it starts with a dash "-" #1167

Closed
opened 2026-02-27 20:01:25 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/librespot-org/librespot/pull/966
Author: @michaelherger
Created: 2/7/2022
Status: Merged
Merged: 2/13/2022
Merged by: @roderickvd

Base: devHead: fix-params-printout


📝 Commits (1)

  • 6f6d330 Only log runtime argument if it starts with a dash "-"

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 src/main.rs (+1 -0)

📄 Description

When there's a value that corresponds to an argument name used in the same command line, the logging of the arguments gets confused and logs the matching argument, but without the leading dash:

% target/debug/librespot -n c --verbose -c /path/to/my/cache
[2022-02-07T22:32:25Z INFO  librespot] librespot 0.3.1 55ced49 (Built on 2022-02-07, Build ID: qaEB8kEW, Profile: debug)
[2022-02-07T22:32:25Z TRACE librespot] Command line argument(s):
[2022-02-07T22:32:25Z TRACE librespot] 		-n "c"
[2022-02-07T22:32:25Z TRACE librespot] 		c "/path/to/my/cache"
[2022-02-07T22:32:25Z TRACE librespot] 		--verbose
[2022-02-07T22:32:25Z TRACE librespot] 		-c "/path/to/my/cache"

Here we're using the literal c as the device name, and the -c argument. Thus the c /path/to/my/cache is logged in addition to -c /path....

After checking whether the key has a leading dash, this issue is gone:

% target/debug/librespot -n c --verbose -c /path/to/my/cache
[2022-02-07T22:32:41Z INFO  librespot] librespot 0.3.1 55ced49 (Built on 2022-02-07, Build ID: qaEB8kEW, Profile: debug)
[2022-02-07T22:32:41Z TRACE librespot] Command line argument(s):
[2022-02-07T22:32:41Z TRACE librespot] 		-n "c"
[2022-02-07T22:32:41Z TRACE librespot] 		--verbose
[2022-02-07T22:32:41Z TRACE librespot] 		-c "/path/to/my/cache"

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/librespot-org/librespot/pull/966 **Author:** [@michaelherger](https://github.com/michaelherger) **Created:** 2/7/2022 **Status:** ✅ Merged **Merged:** 2/13/2022 **Merged by:** [@roderickvd](https://github.com/roderickvd) **Base:** `dev` ← **Head:** `fix-params-printout` --- ### 📝 Commits (1) - [`6f6d330`](https://github.com/librespot-org/librespot/commit/6f6d330bce17061ea5960a593f5c0579a0a822f6) Only log runtime argument if it starts with a dash "-" ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/main.rs` (+1 -0) </details> ### 📄 Description When there's a value that corresponds to an argument name used in the same command line, the logging of the arguments gets confused and logs the matching argument, but without the leading dash: ``` % target/debug/librespot -n c --verbose -c /path/to/my/cache [2022-02-07T22:32:25Z INFO librespot] librespot 0.3.1 55ced49 (Built on 2022-02-07, Build ID: qaEB8kEW, Profile: debug) [2022-02-07T22:32:25Z TRACE librespot] Command line argument(s): [2022-02-07T22:32:25Z TRACE librespot] -n "c" [2022-02-07T22:32:25Z TRACE librespot] c "/path/to/my/cache" [2022-02-07T22:32:25Z TRACE librespot] --verbose [2022-02-07T22:32:25Z TRACE librespot] -c "/path/to/my/cache" ``` Here we're using the literal `c` as the device name, and the `-c` argument. Thus the `c /path/to/my/cache` is logged in addition to `-c /path...`. After checking whether the key has a leading dash, this issue is gone: ``` % target/debug/librespot -n c --verbose -c /path/to/my/cache [2022-02-07T22:32:41Z INFO librespot] librespot 0.3.1 55ced49 (Built on 2022-02-07, Build ID: qaEB8kEW, Profile: debug) [2022-02-07T22:32:41Z TRACE librespot] Command line argument(s): [2022-02-07T22:32:41Z TRACE librespot] -n "c" [2022-02-07T22:32:41Z TRACE librespot] --verbose [2022-02-07T22:32:41Z TRACE librespot] -c "/path/to/my/cache" ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:01:25 +03:00
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#1167
No description provided.