mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-11-09 19:13:14 -06:00
fix(#2): don't partial match id's on named vivenvs
This commit is contained in:
parent
6ddd608d23
commit
158acbcbce
1 changed files with 2 additions and 3 deletions
|
@ -52,7 +52,7 @@ from typing import (
|
||||||
from urllib.error import HTTPError
|
from urllib.error import HTTPError
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
|
|
||||||
__version__ = "23.5a4"
|
__version__ = "23.5a4-3-g6ddd608-dev"
|
||||||
|
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
|
@ -938,12 +938,11 @@ class Viv:
|
||||||
)
|
)
|
||||||
|
|
||||||
def _match_vivenv(self, name_id: str) -> ViVenv: # type: ignore[return]
|
def _match_vivenv(self, name_id: str) -> ViVenv: # type: ignore[return]
|
||||||
# TODO: improve matching algorithm to favor names over id's
|
|
||||||
matches: List[ViVenv] = []
|
matches: List[ViVenv] = []
|
||||||
for k, v in self.vivenvs.items():
|
for k, v in self.vivenvs.items():
|
||||||
if name_id == k or v.name == name_id:
|
if name_id == k or v.name == name_id:
|
||||||
matches.append(v)
|
matches.append(v)
|
||||||
elif k.startswith(name_id) or v.id.startswith(name_id):
|
elif k.startswith(name_id) or (v.id.startswith(name_id) and v.id == v.name):
|
||||||
matches.append(v)
|
matches.append(v)
|
||||||
elif v.name.startswith(name_id):
|
elif v.name.startswith(name_id):
|
||||||
matches.append(v)
|
matches.append(v)
|
||||||
|
|
Loading…
Reference in a new issue