Fixed the same bugs I already fixed (again)

This commit is contained in:
Patrick O'brien 2016-06-14 22:58:46 +10:00
parent 57e20dfd72
commit 6ee58a6529
2 changed files with 6 additions and 9 deletions

11
main.go
View file

@ -7,7 +7,6 @@ import (
"path/filepath"
"strings"
"github.com/davecgh/go-spew/spew"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/viper"
@ -46,11 +45,11 @@ func main() {
// Set up the cobra root command
var rootCmd = &cobra.Command{
Use: "sqlboiler [options] <driver>",
Use: "sqlboiler <driver>",
Short: "SQL Boiler generates boilerplate structs and statements",
Long: "SQL Boiler generates boilerplate structs and statements from template files.\n" +
`Complete documentation is available at http://github.com/nullbio/sqlboiler`,
Example: `sqlboiler -o mymodels -p mymodelpackage postgres`,
Example: `sqlboiler postgres -o models -p models`,
PreRunE: preRun,
RunE: run,
PostRunE: postRun,
@ -58,8 +57,8 @@ func main() {
// Set up the cobra root command flags
rootCmd.PersistentFlags().StringSliceP("tables", "t", nil, "Tables to generate models for, all tables if empty")
rootCmd.PersistentFlags().StringP("output", "o", "output", "The name of the folder to output to")
rootCmd.PersistentFlags().StringP("pkgname", "p", "model", "The name you wish to assign to your generated package")
rootCmd.PersistentFlags().StringP("output", "o", "models", "The name of the folder to output to")
rootCmd.PersistentFlags().StringP("pkgname", "p", "models", "The name you wish to assign to your generated package")
viper.BindPFlags(rootCmd.PersistentFlags())
@ -111,8 +110,6 @@ func preRun(cmd *cobra.Command, args []string) error {
}
}
spew.Dump(cmdConfig)
cmdState, err = New(cmdConfig)
return err
}

View file

@ -50,7 +50,7 @@ func disableTriggers() error {
var stmts []string
{{range .Tables}}
stmts = append(stmts, `ALTER TABLE {{.}} DISABLE TRIGGER ALL;`)
stmts = append(stmts, `ALTER TABLE {{.Name}} DISABLE TRIGGER ALL;`)
{{- end}}
if len(stmts) == 0 {
@ -125,7 +125,7 @@ func LoadConfigFile(filename string) error {
// generated sqlboiler ORM package.
func setup() error {
// Load the config file in the parent directory.
err := LoadConfigFile("../config.toml")
err := LoadConfigFile("../sqlboiler.toml")
if err != nil {
return fmt.Errorf("Unable to load config file: %s", err)
}