mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-11-13 20:47:53 -06:00
refactor: re-use vivenv.bin_exists
This commit is contained in:
parent
7100243470
commit
0411f81159
1 changed files with 8 additions and 9 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.5a7-3-g6e6fb99-dev"
|
__version__ = "23.5a7-4-g7100243-dev"
|
||||||
|
|
||||||
|
|
||||||
class Spinner:
|
class Spinner:
|
||||||
|
@ -711,7 +711,10 @@ def run(
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
log.debug("output:\n" + "\n".join(f"-> {line}" for line in p.stdout.splitlines()))
|
if not verbose:
|
||||||
|
log.debug(
|
||||||
|
"output:\n" + "\n".join(f"-> {line}" for line in p.stdout.splitlines())
|
||||||
|
)
|
||||||
|
|
||||||
if p.returncode != 0 and not ignore_error:
|
if p.returncode != 0 and not ignore_error:
|
||||||
a.subprocess(command, p.stdout)
|
a.subprocess(command, p.stdout)
|
||||||
|
@ -847,11 +850,8 @@ class ViVenv:
|
||||||
|
|
||||||
def bin_exists(self, bin: str) -> None:
|
def bin_exists(self, bin: str) -> None:
|
||||||
if not (self.path / "bin" / bin).is_file():
|
if not (self.path / "bin" / bin).is_file():
|
||||||
message = (
|
message = f"{a.bold}{bin}{a.end} does not exist " "\nOptions:\n"
|
||||||
f"{a.bold}{bin}{a.end} does not exist, "
|
|
||||||
"use -b/--bin to specify an entrypoint"
|
|
||||||
"\nOptions:\n"
|
|
||||||
)
|
|
||||||
message += " " + " ".join(
|
message += " " + " ".join(
|
||||||
(
|
(
|
||||||
a.style(p.name, "bold")
|
a.style(p.name, "bold")
|
||||||
|
@ -1230,8 +1230,7 @@ class Viv:
|
||||||
vivenv = self._match_vivenv(vivenv_id)
|
vivenv = self._match_vivenv(vivenv_id)
|
||||||
bin = vivenv.path / "bin" / cmd
|
bin = vivenv.path / "bin" / cmd
|
||||||
|
|
||||||
if not bin.exists():
|
vivenv.bin_exists(bin)
|
||||||
err_quit(f"{cmd} does not exist in {vivenv.name}")
|
|
||||||
|
|
||||||
full_cmd = [str(bin), *rest]
|
full_cmd = [str(bin), *rest]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue