From 6ffbdd133318836f90145dc271148c429cb5d38f Mon Sep 17 00:00:00 2001 From: Remi Remino Date: Sun, 19 Jan 2014 02:31:36 +0900 Subject: [PATCH] Add heroku alias for setting app or remote name --- plugins/heroku/_heroku | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugins/heroku/_heroku b/plugins/heroku/_heroku index 46663303a..36c6b0bba 100644 --- a/plugins/heroku/_heroku +++ b/plugins/heroku/_heroku @@ -159,3 +159,23 @@ _arguments \ '(--remote)--remote[the remote name]' \ && return 0 +# Alias overriding default "heroku" command to ease setting app or remote name. +# +# heroku @@foo info -> heroku info -a foo +# heroku @foo info -> heroku info -r foo + +heroku() { + if [ $# -gt 0 ] && [ ${1:0:2} = "@@" ] + then + app=${1:2} + shift + command heroku $@ -a $app + elif [ $# -gt 0 ] && [ ${1:0:1} = "@" ] + then + remote=${1:1} + shift + command heroku $@ -r $remote + else + command heroku $@ + fi +}