mirror of https://github.com/bjeanes/dotfiles.git
Add rake completions
parent
8812f7e422
commit
39b3b9858b
|
@ -0,0 +1,20 @@
|
||||||
|
_rake_does_task_list_need_generating () {
|
||||||
|
if [ ! -f .rake_tasks ]; then return 0;
|
||||||
|
else
|
||||||
|
accurate=$(stat -f%m .rake_tasks)
|
||||||
|
changed=$(stat -f%m 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
|
|
@ -13,6 +13,9 @@ source $DOT_FILES/zsh/config
|
||||||
# Rake completion
|
# Rake completion
|
||||||
source $DOT_FILES/zsh/completions
|
source $DOT_FILES/zsh/completions
|
||||||
|
|
||||||
|
# Rake completion
|
||||||
|
source $DOT_FILES/zsh/rake_completion
|
||||||
|
|
||||||
# My custom theme
|
# My custom theme
|
||||||
source $DOT_FILES/zsh/theme
|
source $DOT_FILES/zsh/theme
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue