Skip to content

Commit

Permalink
Merge pull request #426 from DopplerHQ/andre/tui-bugs
Browse files Browse the repository at this point in the history
Fix a few TUI edge cases
  • Loading branch information
Piccirello committed Aug 16, 2023
2 parents 3fdb11d + 5c2922c commit ed0b67d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/tui/gui/cmp_secrets.go
Expand Up @@ -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()
Expand All @@ -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

Expand Down
7 changes: 7 additions & 0 deletions pkg/tui/tui_app.go
Expand Up @@ -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 {
Expand All @@ -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)
Expand Down

0 comments on commit ed0b67d

Please sign in to comment.