Skip to content

Commit 3ea1687

Browse files
committed
green: log debug notice when --debug overrides --quiet
When users set both --quiet and --debug (e.g. KOSLI_QUIET=true in CI plus an ad-hoc --debug flag) the override is silent. Emit a [debug] line so the behaviour is discoverable. Slice 3 (user docs) is a no-op in this repo: --quiet's authoritative in-repo description is the cobra flag help, and kosli docs auto-emits it. Public CI-recipes content lives in the docs.kosli.com repo. Refs #864
1 parent 0542c73 commit 3ea1687

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎cmd/kosli/root.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,9 @@ func initialize(cmd *cobra.Command, out, errOut io.Writer) error {
478478
// a different value now
479479
logger.DebugEnabled = global.Debug
480480
logger.QuietEnabled = global.Quiet && !global.Debug
481+
if global.Quiet && global.Debug {
482+
logger.Debug("--quiet is ignored because --debug is set")
483+
}
481484

482485
var err error
483486
kosliClient, err = requests.NewKosliClient(global.HttpProxy, global.MaxAPIRetries, global.Debug, logger)

‎cmd/kosli/root_test.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ func (suite *RootCommandTestSuite) TestDebugWinsOverQuiet() {
4343
suite.NoError(err)
4444
suite.Contains(stderr, "[warning]",
4545
"--debug should override --quiet, expected warnings in stderr, got: %q", stderr)
46+
suite.Contains(stderr, "[debug] --quiet is ignored because --debug is set",
47+
"expected debug notice that --quiet was overridden, got: %q", stderr)
4648
}
4749

4850
// In order for 'go test' to run this suite, we need to create

0 commit comments

Comments
 (0)