Correct string replace usage in pip2/3 completions

\b does not match "end of spaces" but rather "start of a-z/0-9" and so
does not match the start of string '-c'. Match (and then re-insert) a
literal ' ' as part of the pattern instead.
This commit is contained in:
Mahmoud Al-Qudsi 2017-10-05 13:40:32 +02:00
parent 04bde6cf5b
commit b61c4f1cbc
2 changed files with 2 additions and 2 deletions

View file

@ -3,5 +3,5 @@ if command -sq pip2
# See discussion at https://github.com/fish-shell/fish-shell/pull/4448 # See discussion at https://github.com/fish-shell/fish-shell/pull/4448
# and pip bug at https://github.com/pypa/pip/pull/4755 # and pip bug at https://github.com/pypa/pip/pull/4755
# Keep this even after pip fix is upstreamed for users not on the latest pip # Keep this even after pip fix is upstreamed for users not on the latest pip
pip2 completion --fish | string replace -r "\b-c\s+pip\b" -- "-c pip2" | source pip2 completion --fish | string replace -r -- " -c\s+pip\b" " -c pip2" | source
end end

View file

@ -3,5 +3,5 @@ if command -sq pip3
# See discussion at https://github.com/fish-shell/fish-shell/pull/4448 # See discussion at https://github.com/fish-shell/fish-shell/pull/4448
# and pip bug at https://github.com/pypa/pip/pull/4755 # and pip bug at https://github.com/pypa/pip/pull/4755
# Keep this even after pip fix is upstreamed for users not on the latest pip # Keep this even after pip fix is upstreamed for users not on the latest pip
pip3 completion --fish | string replace -r "\b-c\s+pip\b" -- "-c pip3" | source pip3 completion --fish | string replace -r -- " -c\s+pip\b" " -c pip3" | source
end end