Implement --check-only (#546)

This commit is contained in:
David Boreham 2023-09-27 14:51:52 -06:00 committed by GitHub
parent 06c4a77afe
commit 5beaf69a36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,8 +72,19 @@ def command(ctx, check_only):
# Check if the downloaded file is identical to the existing one # Check if the downloaded file is identical to the existing one
same = filecmp.cmp(temp_download_path, shiv_binary_path) same = filecmp.cmp(temp_download_path, shiv_binary_path)
if same: if same:
if not ctx.obj.quiet or check_only:
print("No update available, latest version already installed")
else:
if not ctx.obj.quiet: if not ctx.obj.quiet:
print("Up update available, latest version already installed") print("Update available")
if check_only:
if not ctx.obj.quiet:
print("Check-only node, update not installed")
else:
if not ctx.obj.quiet:
print("Installing...")
if ctx.obj.verbose: if ctx.obj.verbose:
print(f"Replacing: {shiv_binary_path} with {temp_download_path}") print(f"Replacing: {shiv_binary_path} with {temp_download_path}")
os.replace(temp_download_path, shiv_binary_path) os.replace(temp_download_path, shiv_binary_path)
if not ctx.obj.quiet:
print("Done. Run \"laconic-so version\" to see the newly installed version")