Skip to content

Commit

Permalink
Merge pull request #12 from inteon/remove_v_default
Browse files Browse the repository at this point in the history
BREAKING: remove the default flag value for --v
  • Loading branch information
jetstack-bot committed Jan 26, 2024
2 parents 34a4661 + d4f6b28 commit 2f37bb6
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"io"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/component-base/logs"

Expand Down Expand Up @@ -51,23 +50,7 @@ func NewCertManagerCtlCommand(ctx context.Context, in io.Reader, out, err io.Wri
}
cmds.SetUsageTemplate(usageTemplate())

{
var logFlags pflag.FlagSet
logf.AddFlagsNonDeprecated(logOptions, &logFlags)

logFlags.VisitAll(func(f *pflag.Flag) {
switch f.Name {
case "v":
// "cmctl check api" already had a "v" flag that did not require any value, for
// backwards compatibility we allow the "v" logging flag to be set without a value
// and default to "2" (which will result in the same behaviour as before).
f.NoOptDefVal = "2"
cmds.PersistentFlags().AddFlag(f)
default:
cmds.PersistentFlags().AddFlag(f)
}
})
}
logf.AddFlagsNonDeprecated(logOptions, cmds.PersistentFlags())

ioStreams := genericclioptions.IOStreams{In: in, Out: out, ErrOut: err}
for _, registerCmd := range commands.Commands() {
Expand Down

0 comments on commit 2f37bb6

Please sign in to comment.