Skip to content

Commit

Permalink
git-clone-org fn
Browse files Browse the repository at this point in the history
Signed-off-by: Ricky Elrod <ricky@elrod.me>
  • Loading branch information
relrod committed Jun 21, 2016
1 parent cba2e6c commit 49b2795
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .shellenv/functions.sh
Expand Up @@ -152,3 +152,20 @@ function github_clone_trap {
fi
fi
}

function git-clone-org {
f="$(curl -s "https://api.github.com/orgs/$1/repos?per_page=200" | jq '.[] .name')"
for repo in $f; do
repo="$(echo "$repo" | sed 's/"//g')"
fullrepo="$1/$repo"
if [ ! -d "$repo" ]; then
echo ">> $repo <<"
# this assumes `hub` is installed.
git clone "$fullrepo"
else
pushd "$repo"
git pull
popd
fi
done
}

0 comments on commit 49b2795

Please sign in to comment.