diff --git a/conn/command.go b/conn/command.go index 4b6866b..37c3674 100644 --- a/conn/command.go +++ b/conn/command.go @@ -57,10 +57,9 @@ func (conn *Connection) GetSshConfig(ctx context.Context, name string) (string, func (conn *Connection) GetRepoNames(ctx context.Context, hostname string, repoName string) (string, error) { args := []string{ "repo", "view", hostname + "/" + repoName, - "--json", "owner", - "--json", "name", - "--json", "parent", - "--json", "defaultBranchRef", + "--json", "owner,name,parent,defaultBranchRef", + // disable colored outputs (https://github.com/seachicken/gh-poi/issues/79) + "--jq", ".", } return conn.run(ctx, "gh", args, None) } @@ -101,6 +100,7 @@ func (conn *Connection) GetPullRequests( args := []string{ "api", "graphql", "--hostname", hostname, + "--jq", ".", "-f", fmt.Sprintf(`query=query { search(type: ISSUE, query: "is:pr %s %s", last: 100) { issueCount diff --git a/poi.go b/poi.go index 687a6a7..f15f778 100644 --- a/poi.go +++ b/poi.go @@ -145,9 +145,11 @@ func GetBranches(ctx context.Context, remote Remote, connection Connection, dryR return nil, err } - if pr, err := toPullRequests(json); err == nil { - prs = append(prs, pr...) + pr, err := toPullRequests(json) + if err != nil { + return nil, err } + prs = append(prs, pr...) } branches = applyPullRequest(ctx, branches, prs, connection)