Skip to content
Open
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
13 changes: 11 additions & 2 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"github.com/brevdev/brev-cli/pkg/cmd/delete"
"github.com/brevdev/brev-cli/pkg/cmd/envvars"
"github.com/brevdev/brev-cli/pkg/cmd/fu"
"github.com/brevdev/brev-cli/pkg/cmd/gpucreate"
"github.com/brevdev/brev-cli/pkg/cmd/gpusearch"
"github.com/brevdev/brev-cli/pkg/cmd/healthcheck"
"github.com/brevdev/brev-cli/pkg/cmd/hello"
"github.com/brevdev/brev-cli/pkg/cmd/importideconfig"
Expand Down Expand Up @@ -157,8 +159,13 @@ func NewBrevCommand() *cobra.Command { //nolint:funlen,gocognit,gocyclo // defin
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
breverrors.GetDefaultErrorReporter().AddTag("command", cmd.Name())
// version info gets in the way of the output for
// configure-env-vars, since shells are going to eval it
if featureflag.ShowVersionOnRun() && !printVersion && cmd.Name() != "configure-env-vars" {
// configure-env-vars (shells eval it) and gpu-create/provision (piped to other commands)
skipVersionCommands := map[string]bool{
"configure-env-vars": true,
"gpu-create": true,
"provision": true,
}
if featureflag.ShowVersionOnRun() && !printVersion && !skipVersionCommands[cmd.Name()] {
v, err := remoteversion.BuildCheckLatestVersionString(t, noLoginCmdStore)
// todo this should not be fatal when it errors
if err != nil {
Expand Down Expand Up @@ -270,6 +277,8 @@ func createCmdTree(cmd *cobra.Command, t *terminal.Terminal, loginCmdStore *stor
}
cmd.AddCommand(workspacegroups.NewCmdWorkspaceGroups(t, loginCmdStore))
cmd.AddCommand(scale.NewCmdScale(t, noLoginCmdStore))
cmd.AddCommand(gpusearch.NewCmdGPUSearch(t, noLoginCmdStore))
cmd.AddCommand(gpucreate.NewCmdGPUCreate(t, loginCmdStore))
cmd.AddCommand(configureenvvars.NewCmdConfigureEnvVars(t, loginCmdStore))
cmd.AddCommand(importideconfig.NewCmdImportIDEConfig(t, noLoginCmdStore))
cmd.AddCommand(shell.NewCmdShell(t, loginCmdStore, noLoginCmdStore))
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/cmderrors/cmderrors.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func DisplayAndHandleError(err error) {
case *breverrors.NvidiaMigrationError:
// Handle nvidia migration error
if nvErr, ok := errors.Cause(err).(*breverrors.NvidiaMigrationError); ok {
fmt.Println("\n This account has been migrated to NVIDIA Auth. Attempting to log in with NVIDIA account...")
fmt.Fprintln(os.Stderr, "\n This account has been migrated to NVIDIA Auth. Attempting to log in with NVIDIA account...")
brevBin, err1 := os.Executable()
if err1 == nil {
cmd := exec.Command(brevBin, "login", "--auth", "nvidia") // #nosec G204
Expand Down Expand Up @@ -68,9 +68,9 @@ func DisplayAndHandleError(err error) {
}
}
if featureflag.Debug() || featureflag.IsDev() {
fmt.Println(err)
fmt.Fprintln(os.Stderr, err)
} else {
fmt.Println(prettyErr)
fmt.Fprintln(os.Stderr, prettyErr)
}
}
}
Expand Down
Loading
Loading