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 1b74cdd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
| https://github.com/knative/client/pull/[#]
////

## Unreleased
[cols="1,10,3", options="header", width="100%"]
| | Description | PR

| 🎁
| Prettify printing of webhook warnings
| https://github.com/knative/client/pull/1353[#1353]

## v0.23.0 (2021-05-18)
[cols="1,10,3", options="header", width="100%"]
|===
Expand Down
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 1b74cdd

Please sign in to comment.