Last active
December 22, 2015 20:59
-
-
Save nicjohnson/6530696 to your computer and use it in GitHub Desktop.
Add a collaborator to all Heroku apps available via `heroku apps`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while getopts "a:" opt; do | |
case $opt in | |
a) | |
user=$OPTARG | |
;; | |
\?) | |
echo "Unknown option -$OPTARG" | |
exit 1; | |
;; | |
:) | |
echo "Option -$OPTARG requires an argument" | |
exit 1; | |
esac | |
done | |
if [ -z $user ] ; then | |
echo "You haven't specified an account" | |
exit 1 | |
fi | |
function addUser { | |
heroku sharing:add ${user} -a ${1}; | |
} | |
for app in `heroku apps | grep -v =`; do | |
if [[ $app =~ "@" ]] ; then | |
true | |
else | |
addUser $app | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment