Skip to content
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

Fix error when autocompleting after flag #5789

Merged
merged 2 commits into from
Sep 18, 2018
Merged

Conversation

EpicWink
Copy link
Contributor

When running autocomplete after any command-line option with unspecified 'metavar' attribute, a traceback for an 'AttributeError' would be displayed. This is fixed for first checking if 'metavar' was defined. Fixes #5751

When running autocomplete after any command-line option with unspecified
'metavar' attribute, a traceback for an 'AttributeError' would be
displayed. This is fixed for first checking if 'metavar' was defined.
Fixes pypa#5751
@hugovk
Copy link
Contributor

hugovk commented Sep 18, 2018

Testing this (macOS High Sierra, Python 3.7), looks good:

$ pip install -U git:+https://github.com/EpicWink/pip.git
Collecting git:+https://github.com/EpicWink/pip.git
  Cloning https://github.com/EpicWink/pip.git to /private/var/folders/kt/j77sf4_n6fnbx6pg199rbx700000gn/T/pip-req-build-x7dyjhbk
  Installing build dependencies ... done
Building wheels for collected packages: pip
  Running setup.py bdist_wheel for pip ... done
  Stored in directory: /private/var/folders/kt/j77sf4_n6fnbx6pg199rbx700000gn/T/pip-ephem-wheel-cache-itr_i94m/wheels/27/91/c3/40af79629665bcca2d8f08052f2752b888e7361717a022696a
Successfully built pip
Installing collected packages: pip
  Found existing installation: pip 18.0
    Uninstalling pip-18.0:
      Successfully uninstalled pip-18.0
Successfully installed pip-18.1.dev0

$ pip ins<tab>tall --up<tab>grade p<tab>

That is:

  • Typing pip ins and then pressing tab autocompletes to pip install

  • Typing --up and then pressing tab autocompletes to pip install --upgrade

  • Typing p and then presing tab doesn't autocomplete anything, and doesn't raise any errors.

@pradyunsg pradyunsg added this to the 18.1 milestone Sep 18, 2018
@pradyunsg pradyunsg added C: autocomplete Autocompletion in shells (pip completion) T: bugfix labels Sep 18, 2018
@pradyunsg pradyunsg merged commit 7620b37 into pypa:master Sep 18, 2018
@pradyunsg
Copy link
Member

Thanks @EpicWink! This is exactly what I had in mind. :)

@pradyunsg
Copy link
Member

@EpicWink Would you like to work on another issue?

@lock
Copy link

lock bot commented Jun 1, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 1, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation C: autocomplete Autocompletion in shells (pip completion)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AttributeError on tab completion of pip install -U ...
3 participants