5da20b9d |
_rake_does_task_list_need_generating () { |
86925121 |
if [ ! -f .rake_tasks~ ]; then return 0; |
5da20b9d |
else |
86925121 |
accurate=$(stat -f%m .rake_tasks~) |
5da20b9d |
changed=$(stat -f%m Rakefile)
return $(expr $accurate '>=' $changed)
fi
}
_rake () {
if [ -f Rakefile ]; then
if _rake_does_task_list_need_generating; then |
86925121 |
echo "\nGenerating .rake_tasks~..." > /dev/stderr
rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~ |
5da20b9d |
fi |
86925121 |
compadd `cat .rake_tasks~` |
5da20b9d |
fi
}
compdef _rake rake
function _cap_does_task_list_need_generating () { |
86925121 |
if [ ! -f .cap_tasks~ ]; then return 0; |
5da20b9d |
else |
86925121 |
accurate=$(stat -f%m .cap_tasks~) |
5da20b9d |
changed=$(stat -f%m config/deploy.rb)
return $(expr $accurate '>=' $changed)
fi
}
function _cap () {
if [ -f config/deploy.rb ]; then
if _cap_does_task_list_need_generating; then |
86925121 |
echo "\nGenerating .cap_tasks~..." > /dev/stderr |
5da20b9d |
cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D' |
86925121 |
> .cap_tasks~ |
5da20b9d |
fi |
86925121 |
compadd `cat .cap_tasks~` |
5da20b9d |
fi
}
compdef _cap cap |