Skip to content

Commit b03710f

Browse files
np update check
1 parent 4b21f9f commit b03710f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pkg/cmd/cmd.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import (
4444
"github.com/brevdev/brev-cli/pkg/cmd/tasks"
4545
"github.com/brevdev/brev-cli/pkg/cmd/test"
4646
"github.com/brevdev/brev-cli/pkg/cmd/updatemodel"
47+
"github.com/brevdev/brev-cli/pkg/cmd/version"
4748
"github.com/brevdev/brev-cli/pkg/cmd/workspacegroups"
4849
"github.com/brevdev/brev-cli/pkg/cmd/writeconnectionevent"
4950
"github.com/brevdev/brev-cli/pkg/config"
@@ -59,14 +60,16 @@ import (
5960
)
6061

6162
var (
62-
userFlag string
63-
printVersion bool
63+
userFlag string
64+
printVersion bool
65+
noCheckLatest bool
6466
)
6567

6668
func NewDefaultBrevCommand() *cobra.Command {
6769
cmd := NewBrevCommand()
6870
cmd.PersistentFlags().StringVar(&userFlag, "user", "", "non root user to use for per user configuration of commands run as root")
6971
cmd.PersistentFlags().BoolVar(&printVersion, "version", false, "Print version output")
72+
cmd.PersistentFlags().BoolVar(&noCheckLatest, "no-check-latest", false, "Do not check for the latest version when printing version")
7073
return cmd
7174
}
7275

@@ -187,6 +190,11 @@ func NewBrevCommand() *cobra.Command { //nolint:funlen,gocognit,gocyclo // defin
187190
},
188191
RunE: func(cmd *cobra.Command, args []string) error {
189192
if printVersion {
193+
if noCheckLatest {
194+
// Only print the current version, no network call
195+
t.Vprint(fmt.Sprintf("Current Version: %s", version.Version))
196+
return nil
197+
}
190198
v, err := remoteversion.BuildVersionString(t, noAuthCmdStore)
191199
if err != nil {
192200
t.Errprint(err, "Failed to determine version")

0 commit comments

Comments
 (0)