Skip to content

Instantly share code, notes, and snippets.

@neilkimmett
Created October 9, 2014 14:20
Show Gist options
  • Save neilkimmett/66003d75fcef8aa24a95 to your computer and use it in GitHub Desktop.
Save neilkimmett/66003d75fcef8aa24a95 to your computer and use it in GitHub Desktop.
When you have multiple heroku apps, for one repo, you're going to need a hero! hero production run rake db:migrate
function __hero_get_remote_names
git config --get-regexp 'remote.*.url' heroku.com | sed -E 's/^remote\.([^\.]*)\.url .*$/\1/'
end
function __hero_heroku_app_for
git config --get remote.$argv[1].url | sed -E 's/^[email protected]:([^.]*)\.git/\1/'
end
function __hero_completion
__hero_get_remote_names $argv[1]
end
function hero
set APP (__hero_heroku_app_for $argv[1])
heroku $argv[2..-1] --app $APP
end
complete -f --command hero --arguments '(__hero_completion (commandline -cp))'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment