Skip to content

Commit

Permalink
Remove selected db
Browse files Browse the repository at this point in the history
  • Loading branch information
lewissteele committed Nov 27, 2024
1 parent c1057f5 commit 09d5873
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions cmd/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"image/color"

"github.com/c-bata/go-prompt"
"github.com/charmbracelet/huh"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/lewissteele/dbat/internal/db"
"github.com/lewissteele/dbat/internal/input"
Expand Down Expand Up @@ -94,33 +93,3 @@ func executor(query string) {
func completer(d prompt.Document) []prompt.Suggest {
return []prompt.Suggest{}
}

func selectedDB(args []string) string {
if len(args) > 0 {
return args[0]
}

var name string

options := []huh.Option[string]{}

for _, n := range db.UserDBNames() {
options = append(options, huh.NewOption[string](n, n))
}

form := huh.NewForm(
huh.NewGroup(
huh.NewSelect[string]().Title("database").Value(&name).Options(
options...
),
),
)

err := form.Run()

if err != nil {
panic(err)
}

return name
}

0 comments on commit 09d5873

Please sign in to comment.