mirror of
https://github.com/spf13/cobra
synced 2025-04-27 09:07:19 +00:00
fix documentation of Command.SetOut method
The statement "If newOut is nil, os.Stdout is used" was misleading as `Command.Print` prints to os.Stderr when `outWriter = nil` As the default is based on which one of `OutOrStdout` or `OutOrStderr` is used, i.e. there is no default.
This commit is contained in:
parent
bd4d1655f6
commit
5975d90254
1 changed files with 0 additions and 4 deletions
|
@ -273,7 +273,6 @@ func (c *Command) SetArgs(a []string) {
|
|||
}
|
||||
|
||||
// SetOutput sets the destination for usage and error messages.
|
||||
// If output is nil, os.Stderr is used.
|
||||
// Deprecated: Use SetOut and/or SetErr instead
|
||||
func (c *Command) SetOutput(output io.Writer) {
|
||||
c.outWriter = output
|
||||
|
@ -281,19 +280,16 @@ func (c *Command) SetOutput(output io.Writer) {
|
|||
}
|
||||
|
||||
// SetOut sets the destination for usage messages.
|
||||
// If newOut is nil, os.Stdout is used.
|
||||
func (c *Command) SetOut(newOut io.Writer) {
|
||||
c.outWriter = newOut
|
||||
}
|
||||
|
||||
// SetErr sets the destination for error messages.
|
||||
// If newErr is nil, os.Stderr is used.
|
||||
func (c *Command) SetErr(newErr io.Writer) {
|
||||
c.errWriter = newErr
|
||||
}
|
||||
|
||||
// SetIn sets the source for input data
|
||||
// If newIn is nil, os.Stdin is used.
|
||||
func (c *Command) SetIn(newIn io.Reader) {
|
||||
c.inReader = newIn
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue