Skip to content

Commit

Permalink
python: Use brace expansion for pip compctl match
Browse files Browse the repository at this point in the history
Just use brace expansion only (and not a mix of brace expansion and
path expansion) to expand `sed` match for more variants of 'pip*' (pip,
pip2, pip3, pip2.7, pip3.7 etc.) in `compctl` assignment
  • Loading branch information
indrajitr committed Dec 18, 2018
1 parent 0e6429d commit a338cba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/python/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ if (( $#commands[(i)pip(|[23])] )); then
|| ! -s "$cache_file" ]]; then
# pip is slow; cache its output. And also support 'pip2', 'pip3' variants
$pip_command completion --zsh \
| sed -e "s/\(compctl -K [-_[:alnum:]]*\) pip.*/\1 pip(|[23](|.[0-9]))/" >! "$cache_file" 2> /dev/null
| sed -e "s/\(compctl -K [-_[:alnum:]]* pip\).*/\1{,2,3}{,.{0..9}}/" \
>! "$cache_file" \
2> /dev/null
fi

source "$cache_file"
Expand Down

0 comments on commit a338cba

Please sign in to comment.