lib/rake_completion.zsh
5da20b9d
 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
 }
 
2759586a
 compctl -K _cap cap