my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
712 B

3 years ago
  1. # Set this to 1 if you want to cache the tasks
  2. _cake_cache_task_list=1
  3. # Cache filename
  4. _cake_task_cache_file='.cake_task_cache'
  5. _cake_get_target_list () {
  6. cake | grep '^cake ' | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'
  7. }
  8. _cake_does_target_list_need_generating () {
  9. if [ ${_cake_cache_task_list} -eq 0 ]; then
  10. return 1;
  11. fi
  12. [ ! -f ${_cake_task_cache_file} ] && return 0;
  13. [ Cakefile -nt ${_cake_task_cache_file} ] && return 0;
  14. return 1;
  15. }
  16. _cake () {
  17. if [ -f Cakefile ]; then
  18. if _cake_does_target_list_need_generating; then
  19. _cake_get_target_list > ${_cake_task_cache_file}
  20. compadd `cat ${_cake_task_cache_file}`
  21. else
  22. compadd `_cake_get_target_list`
  23. fi
  24. fi
  25. }
  26. compdef _cake cake