Skip to content

Instantly share code, notes, and snippets.

@arturopie
Created April 9, 2012 18:31
Show Gist options
  • Save arturopie/2345287 to your computer and use it in GitHub Desktop.
Save arturopie/2345287 to your computer and use it in GitHub Desktop.
rake fast autocomplition
# rake autocompletion from:
_rake_does_task_list_need_generating () {
if [ ! -f .rake_tasks~ ]; then return 0;
else
accurate=$(stat -c=%y .rake_tasks~)
changed=$(stat -c=%y Rakefile)
return $(expr $accurate '>=' $changed)
fi
}
_rake () {
if [ -f Rakefile ]; then
if _rake_does_task_list_need_generating; then
echo "\nGenerating .rake_tasks~..." > /dev/stderr
rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~
fi
compadd `cat .rake_tasks~`
fi
}
compdef _rake rake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment