this has gotten out of hand

This commit is contained in:
Daylin Morgan 2023-05-26 17:49:20 -05:00
parent 8277a547bb
commit c5043ff3c3
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F

View file

@ -51,7 +51,7 @@ from typing import (
Generator, Generator,
) )
__version__ = "22.12a3-56-g4566e2e-dev" __version__ = "22.12a3-57-g8277a54-dev"
@dataclass @dataclass
@ -578,11 +578,18 @@ SHOW_TEMPLATE = f"""
""" """
INSTALL_TEMPLATE = f""" INSTALL_TEMPLATE = f"""
Install viv.py to {a.bold}{{src_location}}{a.end} Install viv.py to {a.green}{{src_location}}{a.end}
Symlink {a.bold}{{src_location}}{a.end} to {a.bold}{{cli_location}}{a.end} Symlink {a.bold}{{src_location}}{a.end} to {a.bold}{{cli_location}}{a.end}
""" """
UPDATE_TEMPLATE = f"""
Update source at {a.green}{{src_location}}{a.end}
Symlink {a.bold}{{src_location}}{a.end} to {a.bold}{{cli_location}}{a.end}
Version {a.bold}{{local_version}}{a.end} -> {a.bold}{{next_version}}{a.end}
"""
def noqa(txt: str) -> str: def noqa(txt: str) -> str:
max_length = max(map(len, txt.splitlines())) max_length = max(map(len, txt.splitlines()))
@ -1045,16 +1052,26 @@ class Viv:
sys.path.append(str(c.srccache)) sys.path.append(str(c.srccache))
next_version = __import__(sha256).__version__ next_version = __import__(sha256).__version__
q = ( if self.local_version == next_version:
"Update source at: " echo(f"no change between {args.reference} and local version")
+ a.style(self.running_source, "bold") sys.exit(0)
+ f" \n from version {self.local_version} to {next_version}?"
)
if confirm(q): if confirm(
"Would you like to perform the above installation steps?",
UPDATE_TEMPLATE.format(
src_location=self.local_source,
local_version=self.local_version,
cli_location=args.cli,
next_version=next_version,
),
):
self._install_local_src( self._install_local_src(
sha256, sha256,
args.cli if self.local_source == "Not Found" else args.local_source, Path(
args.src
if self.local_source == "Not Found"
else self.local_source,
),
args.cli, args.cli,
) )