Fix some configuration bits.

- Refix the panics that were occuring (almost all of them).
This commit is contained in:
Aaron L 2016-06-12 12:08:34 -07:00
parent 56234e37a1
commit e0f461014b
2 changed files with 19 additions and 7 deletions

View file

@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"github.com/davecgh/go-spew/spew"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
@ -62,7 +63,7 @@ func main() {
viper.BindPFlags(rootCmd.PersistentFlags())
if err := rootCmd.Execute(); err != nil {
fmt.Println("Failed to execute sqlboiler command:", err)
fmt.Println(err)
os.Exit(-1)
}
}
@ -78,7 +79,7 @@ func preRun(cmd *cobra.Command, args []string) error {
cmdConfig.DriverName = args[0]
cmdConfig.TableName = viper.GetString("table")
cmdConfig.OutFolder = viper.GetString("folder")
cmdConfig.OutFolder = viper.GetString("output")
cmdConfig.PkgName = viper.GetString("pkgname")
if len(cmdConfig.DriverName) == 0 {
@ -98,6 +99,8 @@ func preRun(cmd *cobra.Command, args []string) error {
}
}
spew.Dump(cmdConfig)
var err error
cmdState, err = New(cmdConfig)
return err