-
Notifications
You must be signed in to change notification settings - Fork 446
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
Support shell completion with pipx.pyz #1072
Comments
PR to document this in the FAQ is welcome. |
FAQ? What FAQ? pipx has the I found a working command for Bash but someone needs to test the other shells. Personally I'm not interested in sending a PR but I encourage anyone to do so. ❤️ |
Could be under https://pipx.pypa.io/stable/troubleshooting/ |
Good idea -- preferably in addition to improving the output of |
This solved my problem, thanks
|
How would this feature be useful?
Users of pipx.pyz don't get shell completion for pipx. The current instructions printed by
pipx completions
don't work because theregister-python-argcomplete
command is missing. This is a limitation compared to "full" installations of pipx made with pip install --user, apt, brew, etc.To be specific, I mean users who move pipx.pyz to
~/.local/bin/pipx
(or similar) and mark it executable. I think it's probably impossible to support completion for users who run it explicitly aspython3 /path/to/pipx.pyz ...
, so they are out of scope.Describe the solution you'd like
It turns out this is already possible. It just needs to be documented in
pipx completions
. Instead ofyour bash config file must contain:
I only tested bash. Someone please test the other shells.
Explanation: SHIV_CONSOLE_SCRIPT tells the shiv bootstrap code to use another script bundled inside pipx.pyz. The first
pipx
is the program to run. The secondpipx
is an argument to register-python-complete (telling it what to generate completions for). The2>/dev/null
is necessary to work around linkedin/shiv#240, at least for now.Describe alternatives you've considered
Another option could be to stop using argcomplete and rewrite the whole pipx CLI code with click. pipx already depends on click indirectly because of userpath. click's completion support does not depend on other programs, so it works nicely with pyz files and doesn't need SHIV_CONSOLE_SCRIPT. However all existing users of completion would have to change their configs.
I don't use pipx completion and I don't personally care about this issue. I'm just filing it because I noticed it doesn't already exist.
The text was updated successfully, but these errors were encountered: