github.com/duskeagle/pop@v4.10.1-0.20190417200916-92f2b794aab5+incompatible/soda/cmd/create.go (about) 1 package cmd 2 3 import ( 4 "github.com/gobuffalo/pop" 5 "github.com/spf13/cobra" 6 ) 7 8 var createCmd = &cobra.Command{ 9 Use: "create", 10 Short: "Creates databases for you", 11 RunE: func(cmd *cobra.Command, args []string) error { 12 var err error 13 if all { 14 for _, conn := range pop.Connections { 15 err = pop.CreateDB(conn) 16 if err != nil { 17 return err 18 } 19 } 20 } else { 21 err = pop.CreateDB(getConn()) 22 } 23 return err 24 }, 25 } 26 27 func init() { 28 createCmd.Flags().BoolVarP(&all, "all", "a", false, "Creates all of the databases in the database.yml") 29 RootCmd.AddCommand(createCmd) 30 }