Skip to content

Commit

Permalink
fix: parse yq version for different outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Enda Phelan committed Jan 19, 2022
1 parent c52bcb2 commit f0e68c8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/core/ioutil/dump/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit f0e68c8

Please sign in to comment.