framework1/framework/cobra/hade_command_contract.go

14 lines
406 B
Go
Raw Normal View History

2024-10-20 22:56:46 +08:00
package cobra
import "github.com/Superdanda/hade/framework/contract"
// MustMakeApp 从容器中获取App服务
func (c *Command) MustMakeApp() contract.App {
return c.GetContainer().MustMake(contract.AppKey).(contract.App)
}
// MustMakeKernel 从容器中获取Kernel服务
func (c *Command) MustMakeKernel() contract.Kernel {
return c.GetContainer().MustMake(contract.KernelKey).(contract.Kernel)
}