Skip to content

Commit

Permalink
refactor(root): add the options struct from the command pkg to the ro…
Browse files Browse the repository at this point in the history
…ot command file
  • Loading branch information
danvergara committed Apr 11, 2021
1 parent 2b8f22b commit 8038643
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"os"

"github.com/danvergara/dblab/pkg/command"
"github.com/spf13/cobra"

homedir "github.com/mitchellh/go-homedir"
Expand All @@ -46,13 +47,22 @@ func NewRootCmd() *cobra.Command {
Short: "Interactive databse client",
Long: `dblab is a terminal UI based interactive database client for Postgres, MySQL and SQLite.`,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Printf("driver: %s\n", driver)
fmt.Printf("host: %s\n", host)
fmt.Printf("db: %s\n", db)
fmt.Printf("port: %s\n", port)
fmt.Printf("user: %s\n", user)
fmt.Printf("pass: %s\n", pass)
fmt.Printf("ssl: %s\n", ssl)

opts := command.Options{
Driver: driver,
URL: url,
Host: host,
Port: port,
User: user,
Pass: pass,
DBName: db,
SSL: ssl,
}

opts = command.SetDefault(opts)

fmt.Printf("otps : %v\n", opts)

return nil
},
}
Expand Down

0 comments on commit 8038643

Please sign in to comment.