Bash completion for path in argument (with equals sign present)
I removed all bash completion scripts and started adding them one by one to if any of them cause the problem.
In my case it turned out to be the npm completion script was the cause of this problem.
Not sure (yet) what the problem is, but this is the completion script which caused equal sign values not working as before:
###-begin-npm-completion-### # # npm command completion script # # Installation: npm completion >> ~/.bashrc (or ~/.zshrc) # Or, maybe: npm completion > /usr/local/etc/bash_completion.d/npm # COMP_WORDBREAKS=${COMP_WORDBREAKS/=/} COMP_WORDBREAKS=${COMP_WORDBREAKS/@/} export COMP_WORDBREAKS if type complete &>/dev/null; then _npm_completion () { local si="$IFS" IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \ COMP_LINE="$COMP_LINE" \ COMP_POINT="$COMP_POINT" \ npm completion -- "${COMP_WORDS[@]}" \ 2>/dev/null)) || return $? IFS="$si" } complete -F _npm_completion npm elif type compdef &>/dev/null; then _npm_completion() { si=$IFS compadd -- $(COMP_CWORD=$((CURRENT-1)) \ COMP_LINE=$BUFFER \ COMP_POINT=0 \ npm completion -- "${words[@]}" \ 2>/dev/null) IFS=$si } compdef _npm_completion npm elif type compctl &>/dev/null; then _npm_completion () { local cword line point words si read -Ac words read -cn cword let cword-=1 read -l line read -ln point si="$IFS" IFS=$'\n' reply=($(COMP_CWORD="$cword" \ COMP_LINE="$line" \ COMP_POINT="$point" \ npm completion -- "${words[@]}" \ 2>/dev/null)) || return $? IFS="$si" } compctl -K _npm_completion npm fi ###-end-npm-completion-###
Not sure what environment you're in, but on a recent CentOS
complete -D -o default
enables filename completion after a token w/o whitespace as the default. To toggle it in the other direction:
complete -D -o nospace
However, it looks like older versions of the builtin don't have the -D option.
I resolved the same trouble with Ubuntu 12.04 by using https://github.com/ai/rake-completion.You need to
- download the file
wget -O ~/scripts/rake https://raw.githubusercontent.com/ai/rake-completion/master/rake
- add to your .bashrc:
. ~/scripts/rake
or You can use one of other ways on that page.