Skip to content

Instantly share code, notes, and snippets.

@cybertk
Created July 22, 2014 16:49
Show Gist options
  • Save cybertk/21de6dd86e166236fcbd to your computer and use it in GitHub Desktop.
Save cybertk/21de6dd86e166236fcbd to your computer and use it in GitHub Desktop.
Auto append --app to heroku bin according to ENV['HEROKU_APP']
#!/usr/bin/env python
#
# A simple wrapper support select app by reading from environment vars and
# auto append the --app to origin heroku bin.
#
# Last-updated: Fri Dec 6 17:19:07 CST 2013 by quanlong.
import sys
import os
import subprocess
# Delegate to heroku binary.
sys.argv[0] = '/usr/bin/heroku'
if len(sys.argv) > 2 and 'HEROKU_APP' in os.environ:
sys.argv.insert(2, '--app')
sys.argv.insert(3, os.environ['HEROKU_APP'])
print sys.argv
subprocess.call(sys.argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment