From 9aa3f35f8a1265811797ea58a7159bd8e50c3619 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Fri, 6 Dec 2019 13:33:57 -0800 Subject: [PATCH] Better language in the "no pr" state --- command/pr.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/command/pr.go b/command/pr.go index d124c5e4f..16695798f 100644 --- a/command/pr.go +++ b/command/pr.go @@ -14,6 +14,7 @@ import ( "github.com/github/gh-cli/git" "github.com/github/gh-cli/utils" "github.com/spf13/cobra" + "github.com/spf13/pflag" ) func init() { @@ -181,8 +182,17 @@ func prList(cmd *cobra.Command, args []string) error { } if len(prs) == 0 { - colorOut := colorableOut(cmd) - printMessage(colorOut, "There are no open pull requests") + 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 + msg := "There are no open pull requests" + + userSetFlags := false + cmd.Flags().VisitAll(func(f *pflag.Flag) { + userSetFlags = f.Changed || userSetFlags + }) + if userSetFlags { + msg = "No pull requests matched your search" + } + printMessage(colorErr, msg) return nil }