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 3f3c1c6
Show file tree
Hide file tree
Showing 6 changed files 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
Binary file added website/static/img/ux-assets/json-output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3f3c1c6

Please sign in to comment.