mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-11-09 19:13:14 -06:00
refactor: issues with build_id matching first
This commit is contained in:
parent
14dd82a43d
commit
ad9512a747
1 changed files with 2 additions and 1 deletions
|
@ -551,6 +551,7 @@ class Viv:
|
|||
self.vivenvs = get_venvs()
|
||||
|
||||
def _match_vivenv(self, name_id: str) -> ViVenv:
|
||||
# TODO: improve matching algorithm to favor names over id's
|
||||
matches = []
|
||||
for k, v in self.vivenvs.items():
|
||||
if name_id == k or v.name == name_id:
|
||||
|
@ -562,7 +563,7 @@ class Viv:
|
|||
if not matches:
|
||||
error(f"no matches found for {name_id}", code=1)
|
||||
elif len(matches) > 1:
|
||||
echo(f"matches {','.join(matches)}", hue="red")
|
||||
echo(f"matches {','.join((match.name for match in matches))}", hue="red")
|
||||
error("too many matches maybe try a longer name?", code=1)
|
||||
else:
|
||||
return matches[0]
|
||||
|
|
Loading…
Reference in a new issue