Allow for explicit output to err/stderr
This commit is contained in:
parent
0ea93dd60d
commit
618bc00f80
15
command.go
15
command.go
@ -1121,6 +1121,21 @@ func (c *Command) Printf(format string, i ...interface{}) {
|
|||||||
c.Print(fmt.Sprintf(format, i...))
|
c.Print(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...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// PrintErrln is a convenience method to Println to the defined Err output, fallback to Stderr if not set.
|
||||||
|
func (c *Command) PrintErrln(i ...interface{}) {
|
||||||
|
c.Print(fmt.Sprintln(i...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// PrintErrf is a convenience method to Printf to the defined Err output, fallback to Stderr if not set.
|
||||||
|
func (c *Command) PrintErrf(format string, i ...interface{}) {
|
||||||
|
c.Print(fmt.Sprintf(format, i...))
|
||||||
|
}
|
||||||
|
|
||||||
// CommandPath returns the full path to this command.
|
// CommandPath returns the full path to this command.
|
||||||
func (c *Command) CommandPath() string {
|
func (c *Command) CommandPath() string {
|
||||||
if c.HasParent() {
|
if c.HasParent() {
|
||||||
|
Loading…
Reference in New Issue
Block a user