summaryrefslogtreecommitdiffstats
path: root/client/go
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2022-03-14 09:24:23 +0100
committerMartin Polden <mpolden@mpolden.no>2022-03-14 09:59:58 +0100
commit69245a9c982f0343e39bb01952f5ee0d8df57aed (patch)
treebf5e2004a58fecedddaba7015e7bb3e199dd8719 /client/go
parent8c22fe956da79b46b429cccfdad09f97b9e31e82 (diff)
Rename printErrHint -> printErr
Diffstat (limited to 'client/go')
-rw-r--r--client/go/cmd/api_key.go2
-rw-r--r--client/go/cmd/prod.go2
-rw-r--r--client/go/cmd/root.go12
3 files changed, 8 insertions, 8 deletions
diff --git a/client/go/cmd/api_key.go b/client/go/cmd/api_key.go
index 592ab14f11f..dddc3a31c25 100644
--- a/client/go/cmd/api_key.go
+++ b/client/go/cmd/api_key.go
@@ -70,7 +70,7 @@ func doApiKey(cli *CLI, overwriteKey bool, args []string) error {
apiKeyFile := cli.config.apiKeyPath(app.Tenant)
if util.PathExists(apiKeyFile) && !overwriteKey {
err := fmt.Errorf("refusing to overwrite %s", apiKeyFile)
- cli.printErrHint(err, "Use -f to overwrite it")
+ cli.printErr(err, "Use -f to overwrite it")
printPublicKey(system, apiKeyFile, app.Tenant)
return ErrCLI{error: err, quiet: true}
}
diff --git a/client/go/cmd/prod.go b/client/go/cmd/prod.go
index 9108cb7a222..6764d4a85f2 100644
--- a/client/go/cmd/prod.go
+++ b/client/go/cmd/prod.go
@@ -359,7 +359,7 @@ func prompt(cli *CLI, stdin *bufio.Reader, question, defaultAnswer string, valid
}
if err := validator(input); err != nil {
- cli.printErrHint(err)
+ cli.printErr(err)
fmt.Fprintln(cli.Stderr)
input = ""
}
diff --git a/client/go/cmd/root.go b/client/go/cmd/root.go
index 49cab75be53..f5cda8377dc 100644
--- a/client/go/cmd/root.go
+++ b/client/go/cmd/root.go
@@ -261,7 +261,7 @@ func (c *CLI) configureCommands() {
rootCmd.AddCommand(newVersionCmd(c)) // version
}
-func (c *CLI) printErrHint(err error, hints ...string) {
+func (c *CLI) printErr(err error, hints ...string) {
fmt.Fprintln(c.Stderr, color.RedString("Error:"), err)
for _, hint := range hints {
fmt.Fprintln(c.Stderr, color.CyanString("Hint:"), hint)
@@ -269,10 +269,10 @@ func (c *CLI) printErrHint(err error, hints ...string) {
}
func (c *CLI) printSuccess(msg ...interface{}) {
- log.Print(color.GreenString("Success: "), fmt.Sprint(msg...))
+ fmt.Fprintln(c.Stdout, color.GreenString("Success:"), fmt.Sprint(msg...))
}
-func (c *CLI) printWarning(msg string, hints ...string) {
+func (c *CLI) printWarning(msg interface{}, hints ...string) {
fmt.Fprintln(c.Stderr, color.YellowString("Warning:"), msg)
for _, hint := range hints {
fmt.Fprintln(c.Stderr, color.CyanString("Hint:"), hint)
@@ -287,7 +287,7 @@ func (c *CLI) target(opts targetOptions) (vespa.Target, error) {
}
if !c.isCloudCI() { // Vespa Cloud always runs an up-to-date version
if err := target.CheckVersion(c.version); err != nil {
- c.printWarning(err.Error(), "This version may not work as expected", "Try 'vespa version' to check for a new version")
+ c.printWarning(err, "This version may not work as expected", "Try 'vespa version' to check for a new version")
}
}
return target, nil
@@ -467,10 +467,10 @@ func (c *CLI) Run(args ...string) error {
if err != nil {
if cliErr, ok := err.(ErrCLI); ok {
if !cliErr.quiet {
- c.printErrHint(cliErr, cliErr.hints...)
+ c.printErr(cliErr, cliErr.hints...)
}
} else {
- c.printErrHint(err)
+ c.printErr(err)
}
}
return err