feat: tmpo [-v | --version | --version] now notifies when update available
#26
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:
