Last Updated: February 25, 2016
·
843
· jacaetevha

Heroku commandline helpers

The Issue

I use Bash (and Fish from time to time, but that's another story).

I use Heroku.

I hate writing heroku <some command> --app=<my long app name>.

The Solution

Here are some helper functions and aliases I use in Bash to get around the tedium.

~/.bash_functions

(loaded from my ~/.bashrc)

function h  { heroku ${@:1:($#-1)} --app ${@: -1}  ; }
function hp { h $@ my-really-long-app-name-prod    ; }
function hs { h $@ my-really-long-app-name-stage   ; }
function hd { h $@ my-really-long-app-name-sandbox ; }

~/.bash_aliases

(loaded from my ~/.bashrc)

alias hpc='hp run console'
alias hsc='hs run console'
alias hdc='hd run console'

alias hpl='hp logs'
alias hsl='hs logs'
alias hdl='hd logs'

alias hps='hp pg:psql'
alias hss='hs pg:psql'
alias hds='hd pg:psql'