31 lines
734 B
Go
31 lines
734 B
Go
|
package console
|
||
|
|
||
|
import (
|
||
|
"git.vinchent.xyz/vinchent/go-web/framework"
|
||
|
"git.vinchent.xyz/vinchent/go-web/framework/commands"
|
||
|
"github.com/spf13/cobra"
|
||
|
)
|
||
|
|
||
|
func RunCommand(container framework.Container) error {
|
||
|
rootCmd := &cobra.Command{
|
||
|
Use: "goweb",
|
||
|
Short: "goweb command",
|
||
|
Long: "the command line tool for goweb framework.",
|
||
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||
|
cmd.InitDefaultHelpFlag()
|
||
|
return cmd.Help()
|
||
|
},
|
||
|
CompletionOptions: cobra.CompletionOptions{DisableDefaultCmd: true},
|
||
|
}
|
||
|
|
||
|
rootCmd.SetContainer(container)
|
||
|
commands.AddKernelCommands(rootCmd)
|
||
|
AddAppCommand(rootCmd)
|
||
|
|
||
|
return rootCmd.Execute()
|
||
|
}
|
||
|
|
||
|
func AddAppCommand(rootCmd *cobra.Command) {
|
||
|
// rootCmd.AddCommand(demo.InitFoo())
|
||
|
}
|