Created
May 9, 2011 15:19
-
-
Save bernerdschaefer/962715 to your computer and use it in GitHub Desktop.
some bash helpers for working with padrino projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias rake="time rake" | |
# Run `padrino rake` when inside a padrino project, | |
# otherwise run the normal rake command. | |
function rake () { | |
if [[ -f ".components" ]]; then | |
padrino rake $* | |
else | |
ruby -S rake $* | |
fi | |
} | |
# Shortcut for padrino | |
pd () { | |
padrino $* | |
} | |
# Autocomplete `pd` | |
_pd () { | |
local cur projects | |
eval 'COMPREPLY=()' | |
cur=${COMP_WORDS[COMP_CWORD]} | |
commands=$(\padrino | grep '^ padrino' | awk '{print $2;}') | |
if [ $COMP_CWORD -eq 1 ]; then | |
eval 'COMPREPLY=( $(compgen -o filenames -W "$commands" $cur) )' | |
fi | |
return 0 | |
} | |
complete -F _pd pd |
Thanks! I think there is a problem with rake because seems unable to pass args to the rake try: rake -T
@DAddYE Silly me. It's fixed now!
Thanks man!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice shortcuts. I have a similar set, thanks for sharing these.