feat: create PrintOut() - deprecate Print()

This commit is contained in:
Tiago Carreira 2023-10-02 01:46:07 +01:00
parent e80bdb9a8c
commit 1374825960
No known key found for this signature in database
GPG key ID: 3F13CBCC0395F78C

View file

@ -1414,20 +1414,38 @@ main:
} }
// Print is a convenience method to Print to the defined output, fallback to Stderr if not set. // 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{}) { func (c *Command) Print(i ...interface{}) {
fmt.Fprint(c.OutOrStderr(), i...) fmt.Fprint(c.OutOrStderr(), i...)
} }
// Println is a convenience method to Println to the defined output, fallback to Stderr if not set. // 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{}) { func (c *Command) Println(i ...interface{}) {
c.Print(fmt.Sprintln(i...)) c.Print(fmt.Sprintln(i...))
} }
// Printf is a convenience method to Printf to the defined output, fallback to Stderr if not set. // 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{}) { func (c *Command) Printf(format string, i ...interface{}) {
c.Print(fmt.Sprintf(format, i...)) 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. // PrintErr is a convenience method to Print to the defined Err output, fallback to Stderr if not set.
func (c *Command) PrintErr(i ...interface{}) { func (c *Command) PrintErr(i ...interface{}) {
fmt.Fprint(c.ErrOrStderr(), i...) fmt.Fprint(c.ErrOrStderr(), i...)