Skip to content

Commit

Permalink
Bash completion working properly with colons in tasks names.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiedor committed Sep 23, 2014
1 parent f465a62 commit 16bd0cc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions completion/bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ function _grunt_gruntfile() {

# Enable bash autocompletion.
function _grunt_completions() {
# The currently-being-completed word.
local cur="${COMP_WORDS[COMP_CWORD]}"
# The currently-being-completed word with escaped colons
local cur
_get_comp_words_by_ref -n : cur
# The current gruntfile, if it exists.
local gruntfile="$(_grunt_gruntfile)"
# The current grunt version, available tasks, options, etc.
Expand All @@ -44,6 +45,8 @@ function _grunt_completions() {
[[ "$cur" == -* ]] && compls="$compls $opts"
# Tell complete what stuff to show.
COMPREPLY=($(compgen -W "$compls" -- "$cur"))
# clean input with colons
__ltrim_colon_completions "$cur"
}

complete -o default -F _grunt_completions grunt

0 comments on commit 16bd0cc

Please sign in to comment.