/
root_bare.go
27 lines (24 loc) · 897 Bytes
/
root_bare.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package cmd
import (
"github.com/genghongjie/ginbro/parser"
"github.com/spf13/cobra"
)
// genCmd represents the gen command
var bareCmd = &cobra.Command{
Use: "bare",
Short: "create a bare project",
Long: `create a bare project which its mysql flags are not necessary`,
Example: `ginbro bare -o=github.com/genghongjie/ginbro/out5"`,
Run: func(cmd *cobra.Command, args []string) {
//SELECT table_name FROM information_schema.tables where table_schema='venom';
ng := parser.NewParseEngine("mysqlUser", "mysqlPassword", "127.0.0.1:3306", "mysqlDatabase", "utf8", outPackage, "127.0.0.1:9527", "users", "password")
ng.BareDatabaseSchema()
ng.GenerateProjectCode()
ng.GoFmt()
},
}
func init() {
rootCmd.AddCommand(bareCmd)
bareCmd.Flags().StringVarP(&outPackage, "outPackage", "o", "", "output package relative to $GOPATH/src")
bareCmd.MarkFlagRequired("outPackage")
}