1
mirror of https://github.com/rclone/rclone synced 2024-11-20 21:27:33 +01:00

fs/config: fix certain logs ignoring --quiet

Fixes #8190
This commit is contained in:
Jess 2024-11-18 08:22:01 +13:00
parent d8bc542ffc
commit 1cda54a72d
No known key found for this signature in database
GPG Key ID: BA3350686C918606

View File

@ -315,7 +315,7 @@ func findByName(name string) (*fs.RegInfo, error) {
func printRemoteOptions(name string, prefix string, sep string, redacted bool) {
fsInfo, err := findByName(name)
if err != nil {
fmt.Printf("# %v\n", err)
fs.Logf(nil, "# %v", err)
fsInfo = nil
}
for _, key := range LoadedData().GetKeyList(name) {
@ -334,11 +334,11 @@ func printRemoteOptions(name string, prefix string, sep string, redacted bool) {
}
value := GetValue(name, key)
if redacted && (isSensitive || isPassword) && value != "" {
fmt.Printf("%s%s%sXXX\n", prefix, key, sep)
fs.Logf(nil, "%s%s%sXXX", prefix, key, sep)
} else if isPassword && value != "" {
fmt.Printf("%s%s%s*** ENCRYPTED ***\n", prefix, key, sep)
fs.Logf(nil, "%s%s%s*** ENCRYPTED ***", prefix, key, sep)
} else {
fmt.Printf("%s%s%s%s\n", prefix, key, sep, value)
fs.Logf(nil, "%s%s%s%s", prefix, key, sep, value)
}
}
}
@ -350,13 +350,13 @@ func listRemoteOptions(name string) {
// ShowRemote shows the contents of the remote in config file format
func ShowRemote(name string) {
fmt.Printf("[%s]\n", name)
fs.Logf(nil, "[%s]", name)
printRemoteOptions(name, "", " = ", false)
}
// ShowRedactedRemote shows the contents of the remote in config file format
func ShowRedactedRemote(name string) {
fmt.Printf("[%s]\n", name)
fs.Logf(nil, "[%s]", name)
printRemoteOptions(name, "", " = ", true)
}