From 6ee58a6529414687c5613c53928a2ca5bc8479a6 Mon Sep 17 00:00:00 2001 From: Patrick O'brien Date: Tue, 14 Jun 2016 22:58:46 +1000 Subject: [PATCH] Fixed the same bugs I already fixed (again) --- main.go | 11 ++++------- templates_test/main_test/postgres_main.tpl | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/main.go b/main.go index ebd4da5..bd57ad2 100644 --- a/main.go +++ b/main.go @@ -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] ", + Use: "sqlboiler ", 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 } diff --git a/templates_test/main_test/postgres_main.tpl b/templates_test/main_test/postgres_main.tpl index aaae3e6..87815fb 100644 --- a/templates_test/main_test/postgres_main.tpl +++ b/templates_test/main_test/postgres_main.tpl @@ -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) }