Skip to content

feat: Check for new version of the CLI when running commands#75

Merged
amstuta merged 1 commit intomainfrom
dev/aamstutz/check-new-version
Oct 17, 2025
Merged

feat: Check for new version of the CLI when running commands#75
amstuta merged 1 commit intomainfrom
dev/aamstutz/check-new-version

Conversation

@amstuta
Copy link
Collaborator

@amstuta amstuta commented Oct 17, 2025

Description

Check if a new version of the CLI is available when running any command.

Fixes #56 (issue)

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the style guidelines of this project
  • I have commented my code
  • I ran go mod tidy

@amstuta amstuta requested a review from a team as a code owner October 17, 2025 09:21
rootCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) {
if http.Client == nil {
// Check if a new version is available in a separate goroutine
go func() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should only be launched if version.Version != "undefined"

return
}
if data.TagName != "" && data.TagName != version.Version {
log.Printf("A new version of ovhcloud-cli is available: %s (current: %s)\n", data.TagName, version.Version)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this behave correctly on WASM version ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, I will disable this check in the WASM binary

@amstuta amstuta force-pushed the dev/aamstutz/check-new-version branch from 39bcbd5 to c6a8fbd Compare October 17, 2025 12:36
deathiop
deathiop previously approved these changes Oct 17, 2025
Signed-off-by: Arthur Amstutz <arthur.amstutz@corp.ovh.com>
@amstuta amstuta merged commit 00ac488 into main Oct 17, 2025
5 checks passed
fluatovh pushed a commit to fluatovh/ovhcloud-cli that referenced this pull request Nov 17, 2025
feat: Check for new version of the CLI when running commands
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.

[Feature]: Display a message each time you use a command/subcommand if a newer version of the CLI exists

4 participants