Skip to content

Conversation

@DylanDevelops
Copy link
Owner

@DylanDevelops DylanDevelops commented Dec 19, 2025

Pull Request Checklist

  • I have read and followed the contribution guidelines.
  • My pull request targets the main branch of tmpo.
  • I have tested these changes locally on my machine.

Closes #24

Description

This pull request adds automatic update checking to the CLI tool, so users are notified if a newer version is available when running the version command or using the -v/--version flag. The implementation includes a new internal package for update logic, refactors how version information is displayed, and introduces robust version comparison and testing.

Update notification feature:

  • Added a new internal package internal/update/checker.go that checks for internet connectivity, fetches the latest release from GitHub, compares semantic versions, and determines if an update is available.
  • Introduced the DisplayVersionWithUpdateCheck function in cmd/version.go to display version info and check for updates, used by both the version subcommand and the new version flag.
  • Added a checkForUpdates helper in cmd/version.go that uses the update package to notify the user if a newer release is available, handling errors silently.

CLI improvements:

  • Changed the root command in cmd/root.go to support a -v/--version flag, which now triggers the update check and version display, instead of only showing static version info. [1] [2]

Testing and reliability:

  • Added comprehensive unit tests for version comparison and internet connectivity in internal/update/checker_test.go to ensure correct update detection logic.

Screenshots

Out of date with internet connection:
Screenshot 2025-12-19 at 12 31 11 AM

Out of date without an internet connection:
Screenshot 2025-12-19 at 12 31 44 AM

Introduces an update checker in internal/update, with logic to compare semantic versions and check for internet connectivity. The root command now supports a --version/-v flag that prints version info and checks for updates. Includes tests for version comparison and connectivity.
Consolidated version information display and update check into a single function, DisplayVersionWithUpdateCheck, to reduce code duplication and ensure consistent behavior for both the version command and the version flag.
@DylanDevelops DylanDevelops merged commit 2e174a6 into main Dec 19, 2025
6 checks passed
@DylanDevelops DylanDevelops deleted the ravel/version-improvements branch December 19, 2025 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show if no version is available when running tmpo version

2 participants