Skip to content

Commit

Permalink
Merge pull request #3474 from BronzeDeer/fix-deprecation-completion
Browse files Browse the repository at this point in the history
🐛 fix(completion): Fix completion in deprecated projects
  • Loading branch information
k8s-ci-robot committed Aug 3, 2023
2 parents e94b7f7 + 0f3db00 commit d08f9d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ func (c *CLI) addExtraCommands() error {
func (c CLI) printDeprecationWarnings() {
for _, p := range c.resolvedPlugins {
if p != nil && p.(plugin.Deprecated) != nil && len(p.(plugin.Deprecated).DeprecationWarning()) > 0 {
fmt.Printf(noticeColor, fmt.Sprintf(deprecationFmt, p.(plugin.Deprecated).DeprecationWarning()))
fmt.Fprintf(os.Stderr, noticeColor, fmt.Sprintf(deprecationFmt, p.(plugin.Deprecated).DeprecationWarning()))
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,13 +592,13 @@ plugins:
)
deprecatedPlugin := newMockDeprecatedPlugin("deprecated", "v1", deprecationWarning, projectVersion)

// Overwrite stdout to read the output and reset it afterwards
// Overwrite stderr to read the deprecation output and reset it afterwards
r, w, _ := os.Pipe()
temp := os.Stdout
temp := os.Stderr
defer func() {
os.Stdout = temp
os.Stderr = temp
}()
os.Stdout = w
os.Stderr = w

c, err = New(
WithPlugins(deprecatedPlugin),
Expand Down

0 comments on commit d08f9d7

Please sign in to comment.