Skip to content

Instantly share code, notes, and snippets.

@hsbt
Created November 22, 2010 14:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hsbt/710018 to your computer and use it in GitHub Desktop.
Save hsbt/710018 to your computer and use it in GitHub Desktop.
#compdef _rake rake
_rake_does_task_list_need_generating () {
if [[ ! -f .rake_tasks ]]; then return 0;
else
return $([[ Rakefile -nt .rake_tasks ]])
fi
}
_rake () {
if [[ -f Rakefile ]]; then
if _rake_does_task_list_need_generating; then
echo "\nGenerating .rake_tasks..." >&2
rake --silent --tasks | cut -d " " -f 2 | sed 's/\[.*\]//g' >| .rake_tasks
fi
compadd $(<.rake_tasks)
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment