mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
23 lines
390 B
Go
23 lines
390 B
Go
package cmd
|
|
|
|
import "github.com/spf13/cobra"
|
|
|
|
type CronTaskCmd struct {
|
|
*RootCmd
|
|
}
|
|
|
|
func NewCronTaskCmd() *CronTaskCmd {
|
|
return &CronTaskCmd{NewRootCmd("cronTask")}
|
|
}
|
|
|
|
func (c *CronTaskCmd) addRunE(f func() error) {
|
|
c.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
|
return f()
|
|
}
|
|
}
|
|
|
|
func (c *CronTaskCmd) Exec(f func() error) error {
|
|
c.addRunE(f)
|
|
return c.Execute()
|
|
}
|