formatted gulp completion and used helper function

pull/1782/head
Gurkirat Singh 2021-01-10 19:24:47 +05:30
parent 475393c6b7
commit 538c19b32f
No known key found for this signature in database
GPG Key ID: CFD64E1DCB3DA835
1 changed files with 13 additions and 9 deletions

View File

@ -39,12 +39,16 @@
#
# eval "$(gulp --completion=bash)"
# Enable bash autocompletion.
function _gulp_completions() {
# The currently-being-completed word.
local cur="${COMP_WORDS[COMP_CWORD]}"
#Grab tasks
local compls=$(gulp --tasks-simple)
# Tell complete what stuff to show.
COMPREPLY=($(compgen -W "$compls" -- "$cur"))
}
complete -o default -F _gulp_completions gulp
if _command_exists gulp
then
function _gulp_completions() {
# The currently-being-completed word.
local cur="${COMP_WORDS[COMP_CWORD]}"
#Grab tasks
local compls=$(gulp --tasks-simple)
# Tell complete what stuff to show.
COMPREPLY=($(compgen -W "$compls" -- "$cur"))
}
complete -o default -F _gulp_completions gulp
fi