Skip to content

Commit d08f9d7

Browse files
authored
Merge pull request #3474 from BronzeDeer/fix-deprecation-completion
🐛 fix(completion): Fix completion in deprecated projects
2 parents e94b7f7 + 0f3db00 commit d08f9d7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pkg/cli/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ func (c *CLI) addExtraCommands() error {
444444
func (c CLI) printDeprecationWarnings() {
445445
for _, p := range c.resolvedPlugins {
446446
if p != nil && p.(plugin.Deprecated) != nil && len(p.(plugin.Deprecated).DeprecationWarning()) > 0 {
447-
fmt.Printf(noticeColor, fmt.Sprintf(deprecationFmt, p.(plugin.Deprecated).DeprecationWarning()))
447+
fmt.Fprintf(os.Stderr, noticeColor, fmt.Sprintf(deprecationFmt, p.(plugin.Deprecated).DeprecationWarning()))
448448
}
449449
}
450450
}

pkg/cli/cli_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -592,13 +592,13 @@ plugins:
592592
)
593593
deprecatedPlugin := newMockDeprecatedPlugin("deprecated", "v1", deprecationWarning, projectVersion)
594594

595-
// Overwrite stdout to read the output and reset it afterwards
595+
// Overwrite stderr to read the deprecation output and reset it afterwards
596596
r, w, _ := os.Pipe()
597-
temp := os.Stdout
597+
temp := os.Stderr
598598
defer func() {
599-
os.Stdout = temp
599+
os.Stderr = temp
600600
}()
601-
os.Stdout = w
601+
os.Stderr = w
602602

603603
c, err = New(
604604
WithPlugins(deprecatedPlugin),

0 commit comments

Comments
 (0)