Skip to content

Commit 9aa3f35

Browse files
committed
Better language in the "no pr" state
1 parent 387b9d9 commit 9aa3f35

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

command/pr.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/github/gh-cli/git"
1515
"github.com/github/gh-cli/utils"
1616
"github.com/spf13/cobra"
17+
"github.com/spf13/pflag"
1718
)
1819

1920
func init() {
@@ -181,8 +182,17 @@ func prList(cmd *cobra.Command, args []string) error {
181182
}
182183

183184
if len(prs) == 0 {
184-
colorOut := colorableOut(cmd)
185-
printMessage(colorOut, "There are no open pull requests")
185+
colorErr := colorableErr(cmd) // If the user is piping this command we don't want them to process this message as if it were a PR entry
186+
msg := "There are no open pull requests"
187+
188+
userSetFlags := false
189+
cmd.Flags().VisitAll(func(f *pflag.Flag) {
190+
userSetFlags = f.Changed || userSetFlags
191+
})
192+
if userSetFlags {
193+
msg = "No pull requests matched your search"
194+
}
195+
printMessage(colorErr, msg)
186196
return nil
187197
}
188198

0 commit comments

Comments
 (0)