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.

30 lines
622 B

3 years ago
  1. _mix_refresh () {
  2. if [ -f .mix_tasks ]; then
  3. rm .mix_tasks
  4. fi
  5. echo "Generating .mix_tasks..." > /dev/stderr
  6. _mix_generate
  7. cat .mix_tasks
  8. }
  9. _mix_does_task_list_need_generating () {
  10. [ ! -f .mix_tasks ];
  11. }
  12. _mix_generate () {
  13. mix help | grep '^mix [^ ]' | sed -E "s/mix ([^ ]*) *# (.*)/\1:\2/" > .mix_tasks
  14. }
  15. _mix () {
  16. if [ -f mix.exs ]; then
  17. if _mix_does_task_list_need_generating; then
  18. echo "\nGenerating .mix_tasks..." > /dev/stderr
  19. _mix_generate
  20. fi
  21. local tasks=(${(f)"$(cat .mix_tasks)"})
  22. _describe 'tasks' tasks
  23. fi
  24. }
  25. compdef _mix mix
  26. alias mix_refresh='_mix_refresh'