feat: tmpo [-v | --version | --version] now notifies when update available#26
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
mainbranch of tmpo.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/--versionflag. 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:
internal/update/checker.gothat checks for internet connectivity, fetches the latest release from GitHub, compares semantic versions, and determines if an update is available.DisplayVersionWithUpdateCheckfunction incmd/version.goto display version info and check for updates, used by both the version subcommand and the new version flag.checkForUpdateshelper incmd/version.gothat uses the update package to notify the user if a newer release is available, handling errors silently.CLI improvements:
cmd/root.goto support a-v/--versionflag, which now triggers the update check and version display, instead of only showing static version info. [1] [2]Testing and reliability:
internal/update/checker_test.goto ensure correct update detection logic.Screenshots
Out of date with internet connection:

Out of date without an internet connection:
