bash 734 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. # Borrowed from grunt-cli
  3. # http://gruntjs.com/
  4. #
  5. # Copyright (c) 2012 Tyler Kellen, contributors
  6. # Licensed under the MIT license.
  7. # https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
  8. # Usage:
  9. #
  10. # To enable bash <tab> completion for gulp, add the following line (minus the
  11. # leading #, which is the bash comment character) to your ~/.bashrc file:
  12. #
  13. # eval "$(gulp --completion=bash)"
  14. # Enable bash autocompletion.
  15. function _gulp_completions() {
  16. # The currently-being-completed word.
  17. local cur="${COMP_WORDS[COMP_CWORD]}"
  18. #Grab tasks
  19. local compls=$(gulp --tasks-simple)
  20. # Tell complete what stuff to show.
  21. COMPREPLY=($(compgen -W "$compls" -- "$cur"))
  22. }
  23. complete -o default -F _gulp_completions gulp