Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bash completion working properly with colons in tasks names. #65

Closed
wants to merge 1 commit into from

Conversation

fiedor
Copy link

@fiedor fiedor commented Sep 23, 2014

@tkellen
Copy link
Member

tkellen commented Sep 25, 2014

Thanks for the PR fiedor! I'm reviewing this now.

@tkellen
Copy link
Member

tkellen commented Sep 25, 2014

There need to be some checks to ensure that these don't blow up on older versions of bash.

@tkellen
Copy link
Member

tkellen commented Sep 25, 2014

bash that ships with osx 10.9.4

GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)
Copyright (C) 2007 Free Software Foundation, Inc.

running grunt and hitting tab:

grunt -sh: _get_comp_words_by_ref: command not found
-sh: __ltrim_colon_completions: command not found

@mikemonteith
Copy link

__ltrim_colon_completions can be defined like this

https://github.com/GArik/bash-completion/blob/master/test/lib/library.exp

__ltrim_colon_completions()
{
    if [[ "$1" == *:* && "$COMP_WORDBREAKS" == *:* ]]; then
        # Remove colon-word prefix from COMPREPLY items
        local colon_word=${1%"${1##*:}"}
        local i=${#COMPREPLY[*]}
        while [[ $((--i)) -ge 0 ]]; do
            COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"}
        done
    fi
}

@sindresorhus
Copy link
Member

ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants