diff --git a/fastanime/cli/app_updater.py b/fastanime/cli/app_updater.py index 7e76527..579dd85 100644 --- a/fastanime/cli/app_updater.py +++ b/fastanime/cli/app_updater.py @@ -75,9 +75,9 @@ def is_git_repo(author, repository): return bool(match) and match.group(1) == f"{author}/{repository}" -def update_app(): +def update_app(force=False): is_latest, release_json = check_for_updates() - if is_latest: + if is_latest and not force: print("[green]App is up to date[/]") return False, release_json tag_name = release_json["tag_name"] @@ -101,8 +101,10 @@ def update_app(): ) else: - if PIPX_EXECUTABLE := shutil.which("pipx"): - process = subprocess.run([PIPX_EXECUTABLE, "upgrade", APP_NAME]) + if UV := shutil.which("uv"): + process = subprocess.run([UV, "tool", "upgrade", APP_NAME]) + elif PIPX := shutil.which("pipx"): + process = subprocess.run([PIPX, "upgrade", APP_NAME]) else: PYTHON_EXECUTABLE = sys.executable diff --git a/fastanime/cli/commands/update.py b/fastanime/cli/commands/update.py index ee4be29..8b13bb2 100644 --- a/fastanime/cli/commands/update.py +++ b/fastanime/cli/commands/update.py @@ -11,12 +11,14 @@ import click \b # check for latest release fastanime update --check + + # Force an update regardless of the current version + fastanime update --force """, ) @click.option("--check", "-c", help="Check for the latest release", is_flag=True) -def update( - check, -): +@click.option("--force", "-c", help="Force update", is_flag=True) +def update(check, force): from rich.console import Console from rich.markdown import Markdown @@ -45,7 +47,7 @@ def update( print(f"You are running the latest version ({__version__}) of fastanime") _print_release(github_release_data) else: - success, github_release_data = update_app() + success, github_release_data = update_app(force) _print_release(github_release_data) if success: print("Successfully updated")