Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion internal/core/build_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ func (b *BuildInfo) GetUserAgent() string {
}

func (b *BuildInfo) checkVersion(ctx context.Context) {
if !b.IsRelease() || ExtractEnv(ctx, scwDisableCheckVersionEnv) == "true" {
cmd := extractMeta(ctx).command
cmdDisableCheckVersion := cmd != nil && cmd.DisableVersionCheck
if !b.IsRelease() || ExtractEnv(ctx, scwDisableCheckVersionEnv) == "true" || cmdDisableCheckVersion {
ExtractLogger(ctx).Debug("skipping check version")
return
}
Expand Down
3 changes: 3 additions & 0 deletions internal/core/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ type Command struct {
// DisableTelemetry disable telemetry for the command.
DisableTelemetry bool

// DisableVersionCheck disable the version check to avoid superfluous message
DisableVersionCheck bool

// Hidden hides the command form usage and auto-complete.
Hidden bool

Expand Down
8 changes: 7 additions & 1 deletion internal/namespaces/autocomplete/autocomplete.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,20 @@ import (
)

func GetCommands() *core.Commands {
return core.NewCommands(
cmds := core.NewCommands(
autocompleteRootCommand(),
autocompleteInstallCommand(),
autocompleteCompleteBashCommand(),
autocompleteCompleteFishCommand(),
autocompleteCompleteZshCommand(),
autocompleteScriptCommand(),
)

for _, cmd := range cmds.GetAll() {
cmd.DisableVersionCheck = true
}

return cmds
}

func autocompleteRootCommand() *core.Command {
Expand Down