These take a *lot* of time - `pip3` takes 180ms, `pipenv` takes 320ms
on my system.
Note that this removes a number of obsolete workarounds - pip's was
fixed in 2017 (and pip2 is less and less of a thing), pipenv's change
was in 2019.
Since these are packaging tools with access to the internet they
should really be kept up-to-date, so it is unlikely someone still uses
these old versions.
pipenv switched from older click-completion package to new built-in completions
from click framework in v2021.11.9.
This command achieves compatibility with both, older and more recent versions.
It's now good enough to do so.
We don't allow grid-alignment:
```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z -a '(something)'
```
becomes
```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z -a '(something)'
```
It's just more trouble than it is worth.
The one part I'd change:
We align and/or'd parts of an if-condition with the in-block code:
```fish
if true
and false
dosomething
end
```
becomes
```fish
if true
and false
dosomething
end
```
but it's not used terribly much and if we ever fix it we can just
reindent.
"To assume" and such.
It doesn't check $SHELL, so it might have some other automagic that
can fail (probably still because of the login shell, but I have no
idea).
Override the special variable that
click-completion (https://github.com/click-contrib/click-completion)
uses to force it instead.
Really fixes#6454.
[ci skip]
This checks $SHELL to determine which completions to print, and $SHELL
is typically set by your login program.
So if the login shell isn't fish, this will print the wrong
completions.
Fixes#6454
[ci skip]
* Add pip completion
* We call native pip completion for fish if pip is installed
* Add pipenv completion
* We call pipenv native completion if pipenv is installed
* Applied changes as requested by @floam
* Changed usage of `test (command -v)` for just `command -sq`
* Add completions for pip2/3
* In some systems pip is not aliased and we have pip2 and pip3
* In those cases, we just load the completions for those commands
* Separate pip2/3 completions in their own file as requested by @floam