updated title and tests
This commit is contained in:
parent
c546fd863d
commit
906f49659f
4 changed files with 12 additions and 12 deletions
|
|
@ -108,13 +108,13 @@ func issueList(cmd *cobra.Command, args []string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
fmt.Fprintf(colorableErr(cmd), "\nIssues for %s\n\n", ghrepo.FullName(*baseRepo))
|
||||
|
||||
issues, err := api.IssueList(apiClient, *baseRepo, state, labels, assignee, limit)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("\n%s in %s\n\n", "%s", ghrepo.FullName(*baseRepo))
|
||||
|
||||
if len(issues) == 0 {
|
||||
colorErr := colorableErr(cmd) // Send to stderr because otherwise when piping this command it would seem like the "no open issues" message is actually an issue
|
||||
msg := "There are no open issues"
|
||||
|
|
@ -126,10 +126,12 @@ func issueList(cmd *cobra.Command, args []string) error {
|
|||
if userSetFlags {
|
||||
msg = "No issues match your search"
|
||||
}
|
||||
printMessage(colorErr, msg)
|
||||
fmt.Fprintf(colorErr, title, msg)
|
||||
return nil
|
||||
}
|
||||
|
||||
fmt.Fprintf(colorableErr(cmd), title, utils.Pluralize(len(issues), "issue"))
|
||||
|
||||
out := cmd.OutOrStdout()
|
||||
table := utils.NewTablePrinter(out)
|
||||
for _, issue := range issues {
|
||||
|
|
|
|||
|
|
@ -142,9 +142,8 @@ func TestIssueList_withFlags(t *testing.T) {
|
|||
|
||||
eq(t, output.String(), "")
|
||||
eq(t, output.Stderr(), `
|
||||
Issues for OWNER/REPO
|
||||
No issues match your search in OWNER/REPO
|
||||
|
||||
No issues match your search
|
||||
`)
|
||||
|
||||
bodyBytes, _ := ioutil.ReadAll(http.Requests[1].Body)
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@ func prList(cmd *cobra.Command, args []string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
fmt.Fprintf(colorableErr(cmd), "\nPull requests for %s\n\n", ghrepo.FullName(*baseRepo))
|
||||
|
||||
limit, err := cmd.Flags().GetInt("limit")
|
||||
if err != nil {
|
||||
|
|
@ -192,6 +191,8 @@ func prList(cmd *cobra.Command, args []string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("\n%s in %s\n\n", "%s", ghrepo.FullName(*baseRepo))
|
||||
|
||||
if len(prs) == 0 {
|
||||
colorErr := colorableErr(cmd) // Send to stderr because otherwise when piping this command it would seem like the "no open prs" message is acually a pr
|
||||
msg := "There are no open pull requests"
|
||||
|
|
@ -203,13 +204,12 @@ func prList(cmd *cobra.Command, args []string) error {
|
|||
if userSetFlags {
|
||||
msg = "No pull requests match your search"
|
||||
}
|
||||
printMessage(colorErr, msg)
|
||||
fmt.Fprintf(colorErr, title, msg)
|
||||
return nil
|
||||
}
|
||||
|
||||
prCountMsg := fmt.Sprintf("%d pull requests match your search\n", len(prs))
|
||||
printMessage(colorableErr(cmd), prCountMsg)
|
||||
|
||||
fmt.Fprintf(colorableErr(cmd), title, utils.Pluralize(len(prs), "pull request"))
|
||||
|
||||
table := utils.NewTablePrinter(cmd.OutOrStdout())
|
||||
for _, pr := range prs {
|
||||
prNum := strconv.Itoa(pr.Number)
|
||||
|
|
|
|||
|
|
@ -192,9 +192,8 @@ func TestPRList_filtering(t *testing.T) {
|
|||
|
||||
eq(t, output.String(), "")
|
||||
eq(t, output.Stderr(), `
|
||||
Pull requests for OWNER/REPO
|
||||
No pull requests match your search in OWNER/REPO
|
||||
|
||||
No pull requests match your search
|
||||
`)
|
||||
|
||||
bodyBytes, _ := ioutil.ReadAll(http.Requests[1].Body)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue