about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-02-23 17:47:40 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2016-02-23 17:47:40 +0100
commit4b710e8528d39de369187ab9846d4ab1c4c8fea3 (patch)
treefadf1d51ed78b5cab64f58eb99563fe996ff8aa8
parentc9cf9c95209ba3bf4000ebd3632b9d096dae1646 (diff)
downloadgit-merge-pr-4b710e8528d39de369187ab9846d4ab1c4c8fea3.tar.gz
git-merge-pr-4b710e8528d39de369187ab9846d4ab1c4c8fea3.tar.xz
git-merge-pr-4b710e8528d39de369187ab9846d4ab1c4c8fea3.zip
Show when no open PR are there
-rwxr-xr-xgit-merge-pr4
1 files changed, 3 insertions, 1 deletions
diff --git a/git-merge-pr b/git-merge-pr
index 4e59fe8..464f5f6 100755
--- a/git-merge-pr
+++ b/git-merge-pr
@@ -19,7 +19,9 @@ PROJECT=${PROJECT#//github.com/}
 if [ -z "$PR" ]; then
 	wget -q -O- --header 'Accept: application/json' \
 		"https://api.github.com/repos/${PROJECT}/pulls?direction=asc" |
-		jq -r '.[] | "\(.number) <\(.user.login)> \(.title)"'
+		jq -r 'if length > 0
+			then .[] | "\(.number) <\(.user.login)> \(.title)"
+			else "No open pull requests." end'
 	exit $?
 else
 	shift