feat: additional logging

This commit is contained in:
Daylin Morgan 2023-08-04 10:04:53 -05:00
parent 6e6fb99d1c
commit 7100243470
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F

View file

@ -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-2-g7da6cc7-dev" __version__ = "23.5a7-3-g6e6fb99-dev"
class Spinner: class Spinner:
@ -692,6 +692,9 @@ def run(
verbose: If true, print subcommand output. verbose: If true, print subcommand output.
""" """
# TODO: remove 'verbose' and rely on log level?
log.debug("executing subcmd\n\t" + " ".join(command))
if spinmsg and not verbose: if spinmsg and not verbose:
with Spinner(spinmsg): with Spinner(spinmsg):
p = subprocess.run( p = subprocess.run(
@ -708,6 +711,8 @@ def run(
universal_newlines=True, universal_newlines=True,
) )
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,7 +852,7 @@ class ViVenv:
"use -b/--bin to specify an entrypoint" "use -b/--bin to specify an entrypoint"
"\nOptions:\n" "\nOptions:\n"
) )
message += "\t" + " ".join( message += " " + " ".join(
( (
a.style(p.name, "bold") a.style(p.name, "bold")
for p in (self.path / "bin").iterdir() for p in (self.path / "bin").iterdir()