mirror of
https://github.com/spf13/cobra
synced 2025-05-07 13:57:21 +00:00
Remove/replace SetOutput on Command - deprecated
This commit is contained in:
parent
138b98f39d
commit
6291af1f4d
2 changed files with 2 additions and 16 deletions
|
@ -218,13 +218,6 @@ func (c *Command) SetArgs(a []string) {
|
|||
c.args = a
|
||||
}
|
||||
|
||||
// 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
|
||||
c.errWriter = output
|
||||
}
|
||||
|
||||
// SetOut sets the destination for usage messages.
|
||||
// If newOut is nil, os.Stdout is used.
|
||||
|
|
|
@ -1557,14 +1557,6 @@ func TestEnableCommandSortingIsDisabled(t *testing.T) {
|
|||
EnableCommandSorting = true
|
||||
}
|
||||
|
||||
func TestSetOutput(t *testing.T) {
|
||||
c := &Command{}
|
||||
c.SetOutput(nil)
|
||||
if out := c.OutOrStdout(); out != os.Stdout {
|
||||
t.Errorf("Expected setting output to nil to revert back to stdout")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetOut(t *testing.T) {
|
||||
c := &Command{}
|
||||
c.SetOut(nil)
|
||||
|
@ -1814,7 +1806,8 @@ func (tc *calledAsTestcase) test(t *testing.T) {
|
|||
parent.SetArgs(tc.args)
|
||||
|
||||
output := new(bytes.Buffer)
|
||||
parent.SetOutput(output)
|
||||
parent.SetOut(output)
|
||||
parent.SetErr(output)
|
||||
|
||||
parent.Execute()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue