结构调整添加cmd
This commit is contained in:
1 parent
f2829bfd98
commit
a2f4c00246
72 files changed
+838
-597
No files matched your search
@@ -0,0 +1,34 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"go-admin/cmd/api"
|
||||
"go-admin/cmd/migrate"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "go-admin",
|
||||
Short: "-v",
|
||||
SilenceUsage: true,
|
||||
DisableAutoGenTag: true,
|
||||
Long: `go-admin`,
|
||||
PersistentPreRunE: func(*cobra.Command, []string) error { return nil },
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
usageStr := `go-admin 0.0.1`
|
||||
log.Printf("%s\n", usageStr)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(api.StartCmd)
|
||||
rootCmd.AddCommand(migrate.StartCmd)
|
||||
}
|
||||
|
||||
//Execute : apply commands
|
||||
func Execute() {
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
os.Exit(-1)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user