mirror of
https://github.com/casbin/bee.git
synced 2025-07-17 13:14:19 +08:00
Added PreRun phase to Command struct
Now each command has a PreRun function that will execute before calling the Run() function. This allows to show the banner and do some pre-check work. Also moved parsePackagesFromDir() to the main function to avoid getting called each time 'bee' is invoked.
This commit is contained in:
@ -298,14 +298,13 @@ var hproseAddFunctions = []string{}
|
||||
|
||||
func init() {
|
||||
cmdHproseapp.Run = createhprose
|
||||
cmdHproseapp.PreRun = func(cmd *Command, args []string) { ShowShortVersionBanner() }
|
||||
cmdHproseapp.Flag.Var(&tables, "tables", "specify tables to generate model")
|
||||
cmdHproseapp.Flag.Var(&driver, "driver", "database driver: mysql, postgresql, etc.")
|
||||
cmdHproseapp.Flag.Var(&conn, "conn", "connection string used by the driver to connect to a database instance")
|
||||
}
|
||||
|
||||
func createhprose(cmd *Command, args []string) int {
|
||||
ShowShortVersionBanner()
|
||||
|
||||
w := NewColorWriter(os.Stdout)
|
||||
|
||||
curpath, _ := os.Getwd()
|
||||
|
Reference in New Issue
Block a user