summaryrefslogtreecommitdiff
path: root/vendor/github.com/spf13/cobra/cobra.go
diff options
context:
space:
mode:
authordependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>2021-02-10 09:18:31 +0000
committerValentin Rothberg <rothberg@redhat.com>2021-02-10 12:35:20 +0100
commit46b014bad5f1d471a2ebfd819dfdf33a184ea109 (patch)
tree2743957c7d5919f25846037421a0ef8963c6b266 /vendor/github.com/spf13/cobra/cobra.go
parent055e2dda3a1888d319d542abe8735e791e736451 (diff)
downloadpodman-46b014bad5f1d471a2ebfd819dfdf33a184ea109.tar.gz
podman-46b014bad5f1d471a2ebfd819dfdf33a184ea109.tar.bz2
podman-46b014bad5f1d471a2ebfd819dfdf33a184ea109.zip
Bump github.com/spf13/cobra from 1.1.1 to 1.1.2
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.1.1 to 1.1.2. - [Release notes](https://github.com/spf13/cobra/releases) - [Changelog](https://github.com/spf13/cobra/blob/master/CHANGELOG.md) - [Commits](https://github.com/spf13/cobra/compare/v1.1.1...v1.1.2) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/spf13/cobra/cobra.go')
-rw-r--r--vendor/github.com/spf13/cobra/cobra.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/vendor/github.com/spf13/cobra/cobra.go b/vendor/github.com/spf13/cobra/cobra.go
index d01becc8f..d6cbfd719 100644
--- a/vendor/github.com/spf13/cobra/cobra.go
+++ b/vendor/github.com/spf13/cobra/cobra.go
@@ -19,6 +19,7 @@ package cobra
import (
"fmt"
"io"
+ "os"
"reflect"
"strconv"
"strings"
@@ -205,3 +206,17 @@ func stringInSlice(a string, list []string) bool {
}
return false
}
+
+// CheckErr prints the msg with the prefix 'Error:' and exits with error code 1. If the msg is nil, it does nothing.
+func CheckErr(msg interface{}) {
+ if msg != nil {
+ fmt.Fprintln(os.Stderr, "Error:", msg)
+ os.Exit(1)
+ }
+}
+
+// WriteStringAndCheck writes a string into a buffer, and checks if the error is not nil.
+func WriteStringAndCheck(b io.StringWriter, s string) {
+ _, err := b.WriteString(s)
+ CheckErr(err)
+}