diff --git a/script/ghco b/script/ghco index a57ac1f..6e17121 100755 --- a/script/ghco +++ b/script/ghco @@ -5,7 +5,16 @@ set -e export GH_NO_UPDATE_NOTIFIER=1 -prid=$(gh pr list --limit 100 | fzf | awk '{print $1}') +if [ "$1" = '-a' ]; then + cmd='gh pr list --limit 100' +elif [ -z "$GITHUB_USERNAME" ]; then + echo 'set $GITHUB_USERNAME first' + exit 1 +else + cmd="gh pr list --author $GITHUB_USERNAME" +fi + +prid=$(eval "$cmd" | fzf | awk '{print $1}') if [ -z $prid ]; then exit 0 fi