From e635f4c0be24cdf2272b2c6018939e8469e4c6d5 Mon Sep 17 00:00:00 2001 From: Alex Chen Date: Wed, 23 Jun 2021 00:32:26 +0800 Subject: [PATCH] fs: make --dump imply -vv (#5418) --- fs/config/configflags/configflags.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/fs/config/configflags/configflags.go b/fs/config/configflags/configflags.go index 442aeca1f..d893f0017 100644 --- a/fs/config/configflags/configflags.go +++ b/fs/config/configflags/configflags.go @@ -152,6 +152,19 @@ func ParseHeaders(headers []string) []*fs.HTTPOption { // SetFlags converts any flags into config which weren't straight forward func SetFlags(ci *fs.ConfigInfo) { + if dumpHeaders { + ci.Dump |= fs.DumpHeaders + fs.Logf(nil, "--dump-headers is obsolete - please use --dump headers instead") + } + if dumpBodies { + ci.Dump |= fs.DumpBodies + fs.Logf(nil, "--dump-bodies is obsolete - please use --dump bodies instead") + } + if ci.Dump != 0 && verbose < 2 && ci.LogLevel != fs.LogLevelDebug { + fs.Logf(nil, "Automatically setting -vv as --dump is enabled") + verbose = 2 + } + if verbose >= 2 { ci.LogLevel = fs.LogLevelDebug } else if verbose >= 1 { @@ -197,15 +210,6 @@ func SetFlags(ci *fs.ConfigInfo) { } } - if dumpHeaders { - ci.Dump |= fs.DumpHeaders - fs.Logf(nil, "--dump-headers is obsolete - please use --dump headers instead") - } - if dumpBodies { - ci.Dump |= fs.DumpBodies - fs.Logf(nil, "--dump-bodies is obsolete - please use --dump bodies instead") - } - switch { case deleteBefore && (deleteDuring || deleteAfter), deleteDuring && deleteAfter: