JCS-pub/client/internal/cmdline/commandline.go

21 lines
356 B
Go

package cmdline
import (
"github.com/spf13/cobra"
"gitlink.org.cn/cloudream/jcs-pub/client/internal/services"
)
type CommandContext struct {
svc *services.Service
}
var RootCmd = cobra.Command{}
func GetCmdCtx(cmd *cobra.Command) *CommandContext {
return cmd.Context().Value("cmdCtx").(*CommandContext)
}
func RootExecute() {
RootCmd.Execute()
}