mix-fast.plugin.zsh 570 B

1234567891011121314151617181920212223242526272829
  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 -v 'iex -S' | tail -n +2 | cut -d " " -f 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. compadd `cat .mix_tasks`
  22. fi
  23. }
  24. compdef _mix mix
  25. alias mix_refresh='_mix_refresh'