提交 d339351a 编写于 作者: A Antony Lee 提交者: Xavier Fernandez

Autocomplete installed dists in `pip show ...`. (#4749)

* Autocomplete installed dists in `pip show ...`.

* 🎨 Assign to a variable to satisfy linters
上级 41e3ddcf
The command-line autocompletion engine ``pip show`` now autocompletes installed
distribution names.
......@@ -87,8 +87,12 @@ def autocomplete():
# special case: 'help' subcommand has no options
if subcommand_name == 'help':
sys.exit(1)
# special case: list locally installed dists for uninstall command
if subcommand_name == 'uninstall' and not current.startswith('-'):
# special case: list locally installed dists for show and uninstall
should_list_installed = (
subcommand_name in ['show', 'uninstall'] and
not current.startswith('-')
)
if should_list_installed:
installed = []
lc = current.lower()
for dist in get_installed_distributions(local_only=True):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册