Skip to content

Instantly share code, notes, and snippets.

@nicjohnson
Last active December 22, 2015 20:59
Show Gist options
  • Save nicjohnson/6530696 to your computer and use it in GitHub Desktop.
Save nicjohnson/6530696 to your computer and use it in GitHub Desktop.
Add a collaborator to all Heroku apps available via `heroku apps`
#!/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