mirror of
https://github.com/casbin/bee.git
synced 2025-07-18 00:04:20 +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:
5
bale.go
5
bale.go
@ -32,7 +32,7 @@ var cmdBale = &Command{
|
||||
Long: `
|
||||
Bale command compress all the static files in to a single binary file.
|
||||
|
||||
This is usefull to not have to carry static files including js, css, images
|
||||
This is useful to not have to carry static files including js, css, images
|
||||
and views when publishing a project.
|
||||
|
||||
auto-generate unpack function to main package then run it during the runtime.
|
||||
@ -43,11 +43,10 @@ This is mainly used for zealots who are requiring 100% Go code.
|
||||
|
||||
func init() {
|
||||
cmdBale.Run = runBale
|
||||
cmdBale.PreRun = func(cmd *Command, args []string) { ShowShortVersionBanner() }
|
||||
}
|
||||
|
||||
func runBale(cmd *Command, args []string) int {
|
||||
ShowShortVersionBanner()
|
||||
|
||||
err := loadConfig()
|
||||
if err != nil {
|
||||
logger.Fatalf("Failed to load configuration: %s", err)
|
||||
|
Reference in New Issue
Block a user