fix: Add verbose output for version check

This commit is contained in:
Paul Gauthier 2024-08-13 05:34:53 -07:00
parent 76a4b878b1
commit ad16cc3c41

View file

@ -16,6 +16,9 @@ def check_version(io, just_check=False, verbose=False):
day = 60 * 60 * 24
since = time.time() - fname.stat().st_mtime
if since < day:
if verbose:
hours = since / 60 / 60
io.tool_output(f"Too soon to check version: {hours:.1f} hours")
return
# To keep startup fast, avoid importing this unless needed
@ -27,7 +30,7 @@ def check_version(io, just_check=False, verbose=False):
latest_version = data["info"]["version"]
current_version = aider.__version__
if just_check:
if just_check or verbose:
io.tool_output(f"Current version: {current_version}")
io.tool_output(f"Latest version: {latest_version}")
@ -41,11 +44,13 @@ def check_version(io, just_check=False, verbose=False):
fname.parent.mkdir(parents=True, exist_ok=True)
fname.touch()
if just_check:
if just_check or verbose:
if is_update_available:
io.tool_output("Update available")
else:
io.tool_output("No update available")
if just_check:
return is_update_available
if not is_update_available: