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:
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user