gulp.plugin.zsh 633 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env zsh
  2. #
  3. # gulp-autocompletion-zsh
  4. #
  5. # Autocompletion for your gulp.js tasks
  6. #
  7. # Copyright(c) 2014 André König <andre.koenig@posteo.de>
  8. # MIT Licensed
  9. #
  10. #
  11. # André König
  12. # Github: https://github.com/akoenig
  13. # Twitter: https://twitter.com/caiifr
  14. #
  15. #
  16. # Grabs all available tasks from the `gulpfile.js`
  17. # in the current directory.
  18. #
  19. function $$gulp_completion {
  20. compls="$(grep -Eo "gulp.task\((['\"](([a-zA-Z0-9]|-)*)['\"],)" gulpfile.js 2>/dev/null | grep -Eo "['\"](([a-zA-Z0-9]|-)*)['\"]" | sed s/"['\"]"//g | sort)"
  21. completions=(${=compls})
  22. compadd -- $completions
  23. }
  24. compdef $$gulp_completion gulp