Keep cobra's output streams at their defaults in cli.Main
check / check (push) Successful in 1m10s

cli.Main no longer calls SetOut or SetErr. SetOut also moved the usage
and an unknown help topic, which cobra writes to stderr, onto stdout.
execute now takes the command tree, so the tests build it, set its
arguments and output streams, and run it; the exit line goes to the
command's error stream, which outside a test is stderr as before.

Model: opus-5-5
This commit is contained in:
clawbot
2026-09-28 23:42:59 +00:00
parent 86863653f8
commit 54596ef54b
3 changed files with 31 additions and 18 deletions
+8 -4
View File
@@ -1,7 +1,11 @@
package cli
// Execute is execute, exported for the external test package, which
// needs to supply the arguments and read the output.
// RootCmd and Execute are rootCmd and execute, exported for the external
// test package, which builds the command tree itself so that it can
// supply the arguments and read the output.
//
//nolint:gochecknoglobals // a test seam, not mutable state.
var Execute = execute
//nolint:gochecknoglobals // test seams, not mutable state.
var (
RootCmd = rootCmd
Execute = execute
)