From f0e68c8f667ed1ff5f298f7dc49541fcf4520e19 Mon Sep 17 00:00:00 2001 From: Enda Phelan Date: Wed, 19 Jan 2022 12:31:01 +0000 Subject: [PATCH] fix: parse yq version for different outputs --- pkg/core/ioutil/dump/dump.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/core/ioutil/dump/dump.go b/pkg/core/ioutil/dump/dump.go index dbfbd4f1e..ee68985b1 100644 --- a/pkg/core/ioutil/dump/dump.go +++ b/pkg/core/ioutil/dump/dump.go @@ -5,12 +5,13 @@ import ( "bytes" "encoding/json" "fmt" - "github.com/redhat-developer/app-services-cli/pkg/core/cmdutil" "io" "os" "os/exec" "strings" + "github.com/redhat-developer/app-services-cli/pkg/core/cmdutil" + "github.com/landoop/tableprinter" "gitlab.com/c0b/go-ordered-json" "gopkg.in/yaml.v2" @@ -123,7 +124,13 @@ func haveYQ(minVersion int) bool { return false } - versionStr := strings.TrimSpace(strings.TrimLeft(string(versionOutput), "yq version")) + prefixes := []string{"yq", "(https://github.com/mikefarah/yq/)", "version"} + + versionStr := string(versionOutput) + for _, p := range prefixes { + versionStr = strings.TrimSpace(strings.TrimLeft(string(versionStr), p)) + } + if versionStr == "" { return false }