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