mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 18:17:55 +00:00
Adding type checking to ensure only BasicUi is affected
This commit is contained in:
@@ -3,6 +3,7 @@ package command
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -60,8 +61,12 @@ func (c *ReadCommand) Run(args []string) int {
|
|||||||
// not desired. Since Vault CLI currently only uses BasicUi,
|
// not desired. Since Vault CLI currently only uses BasicUi,
|
||||||
// which writes to standard output, os.Stdout is used here to
|
// which writes to standard output, os.Stdout is used here to
|
||||||
// directly print the message. If mitchellh/cli exposes method
|
// directly print the message. If mitchellh/cli exposes method
|
||||||
// to print without CR, this has to be replaced by that.
|
// to print without CR, this check needs to be removed.
|
||||||
fmt.Fprintf(os.Stdout, val.(string))
|
if reflect.TypeOf(c.Ui).String() == "*cli.BasicUi" {
|
||||||
|
fmt.Fprintf(os.Stdout, val.(string))
|
||||||
|
} else {
|
||||||
|
c.Ui.Output(val.(string))
|
||||||
|
}
|
||||||
return 0
|
return 0
|
||||||
} else {
|
} else {
|
||||||
c.Ui.Error(fmt.Sprintf(
|
c.Ui.Error(fmt.Sprintf(
|
||||||
|
|||||||
Reference in New Issue
Block a user