diff --git a/pkg/tui/gui/cmp_secrets.go b/pkg/tui/gui/cmp_secrets.go index 9edbde99..fb05a08f 100644 --- a/pkg/tui/gui/cmp_secrets.go +++ b/pkg/tui/gui/cmp_secrets.go @@ -204,8 +204,9 @@ func (self *SecretsComponent) createSVMs() error { } } - if len(self.secretVMs) > 0 { - self.activeSVM = self.secretVMs[0] + visibleSVMs := self.visibleSVMs() + if len(visibleSVMs) > 0 { + self.activeSVM = visibleSVMs[0] } curViewName := self.gui.g.CurrentView().Name() @@ -219,6 +220,10 @@ func (self *SecretsComponent) createSVMs() error { } func (self *SecretsComponent) ToggleNameValue() error { + if len(self.visibleSVMs()) == 0 { + return nil + } + isNameFocused := strings.Index(self.gui.g.CurrentView().Name(), "SVM:Name:") == 0 isEditing := self.gui.g.CurrentView().Editable diff --git a/pkg/tui/tui_app.go b/pkg/tui/tui_app.go index 485fe27c..9a614c6a 100644 --- a/pkg/tui/tui_app.go +++ b/pkg/tui/tui_app.go @@ -17,10 +17,12 @@ package tui import ( "log" + "os" "github.com/DopplerHQ/cli/pkg/models" "github.com/DopplerHQ/cli/pkg/tui/common" "github.com/DopplerHQ/cli/pkg/tui/gui" + "github.com/DopplerHQ/cli/pkg/utils" ) type App struct { @@ -34,6 +36,11 @@ func Start(opts models.ScopedOptions) { log.Fatal(err) } + if cmn.Opts.EnclaveProject.Value == "" { + utils.Log("You must run `doppler setup` prior to launching the TUI") + os.Exit(1) + } + gui, err := gui.NewGui(cmn) if err != nil { log.Fatal(err)