Skip to content

Commit

Permalink
feat: create PrintOut() - deprecate Print()
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarreira committed Oct 2, 2023
1 parent e80bdb9 commit 1374825
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -1414,20 +1414,38 @@ main:
}

// Print is a convenience method to Print to the defined output, fallback to Stderr if not set.
// Deprecated: Use PrintOut or PrintErr instead.
func (c *Command) Print(i ...interface{}) {
fmt.Fprint(c.OutOrStderr(), i...)
}

// Println is a convenience method to Println to the defined output, fallback to Stderr if not set.
// Deprecated: Use PrintOutln or PrintErrln instead.
func (c *Command) Println(i ...interface{}) {
c.Print(fmt.Sprintln(i...))
}

// Printf is a convenience method to Printf to the defined output, fallback to Stderr if not set.
// Deprecated: Use PrintOutf or PrintErrf instead.
func (c *Command) Printf(format string, i ...interface{}) {
c.Print(fmt.Sprintf(format, i...))
}

// PrintOut is a convenience method to Print to the defined OutStream, fallback to Stdout if not set.
func (c *Command) PrintOut(i ...interface{}) {
fmt.Fprint(c.OutOrStdout(), i...)
}

// PrintOutln is a convenience method to Println to the defined OutStream, fallback to Stdout if not set.
func (c *Command) PrintOutln(i ...interface{}) {
c.PrintOut(fmt.Sprintln(i...))
}

// PrintOutf is a convenience method to Printf to the defined OutStream, fallback to Stdout if not set.
func (c *Command) PrintOutf(format string, i ...interface{}) {
c.PrintOut(fmt.Sprintf(format, i...))
}

// PrintErr is a convenience method to Print to the defined Err output, fallback to Stderr if not set.
func (c *Command) PrintErr(i ...interface{}) {
fmt.Fprint(c.ErrOrStderr(), i...)
Expand Down

0 comments on commit 1374825

Please sign in to comment.