Skip to content

Instantly share code, notes, and snippets.

@solon
Forked from bernerdschaefer/gist:962715
Created May 9, 2011 18:09
Show Gist options
  • Save solon/963011 to your computer and use it in GitHub Desktop.
Save solon/963011 to your computer and use it in GitHub Desktop.
some bash helpers for working with padrino projects
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment