mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-06 09:20:57 +01:00
heal completers pip
This commit is contained in:
parent
63232fe664
commit
df12587590
1 changed files with 13 additions and 5 deletions
|
@ -1,12 +1,20 @@
|
|||
"""Completers for pip."""
|
||||
# pylint: disable=invalid-name, missing-docstring, unsupported-membership-test
|
||||
# pylint: disable=unused-argument, not-an-iterable
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
import xonsh.lazyasd as xl
|
||||
|
||||
PIP_RE = xl.LazyObject(lambda: re.compile("pip(?:\d|\.)*"),
|
||||
globals(), 'PIP_RE')
|
||||
PIP_LIST_RE = xl.LazyObject(lambda: re.compile("pip(?:\d|\.)* (?:uninstall|show)"),
|
||||
globals(), 'PIP_LIST_RE')
|
||||
|
||||
@xl.lazyobject
|
||||
def PIP_RE():
|
||||
return re.compile(r"pip(?:\d|\.)*")
|
||||
|
||||
|
||||
@xl.lazyobject
|
||||
def PIP_LIST_RE():
|
||||
return re.compile(r"pip(?:\d|\.)* (?:uninstall|show)")
|
||||
|
||||
|
||||
@xl.lazyobject
|
||||
|
@ -16,7 +24,7 @@ def ALL_COMMANDS():
|
|||
stderr=subprocess.DEVNULL))
|
||||
except FileNotFoundError:
|
||||
return []
|
||||
commands = re.findall(" (\w+) ", help_text)
|
||||
commands = re.findall(r" (\w+) ", help_text)
|
||||
return [c for c in commands if c not in ['completion', 'help']]
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue