Skip to content

Commit

Permalink
Prettify printing of webhook warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
markusthoemmes committed Jun 24, 2021
1 parent 8ac780f commit 30727b0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/kn/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"time"

"github.com/spf13/cobra"
"k8s.io/client-go/rest"

"knative.dev/client/pkg/kn/config"
"knative.dev/client/pkg/kn/plugin"
Expand All @@ -35,6 +36,14 @@ func init() {
}

func main() {
// Override client-go's warning handler to give us nicely printed warnings.
rest.SetDefaultWarningHandler(
rest.NewWarningWriter(os.Stderr, rest.WarningWriterOptions{
// only print a given warning the first time we receive it
Deduplicate: true,
}),
)

err := run(os.Args[1:])
if err != nil && len(os.Args) > 1 {
printError(err)
Expand Down

0 comments on commit 30727b0

Please sign in to comment.