diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 9ef510fcea..73ca5ee1c1 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -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%"] |=== diff --git a/cmd/kn/main.go b/cmd/kn/main.go index 9ff96a48ce..49d2391570 100644 --- a/cmd/kn/main.go +++ b/cmd/kn/main.go @@ -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" @@ -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)