You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/pkg/common/cmd/cron_task.go

23 lines
390 B

2 years ago
package cmd
import "github.com/spf13/cobra"
type CronTaskCmd struct {
*RootCmd
}
func NewCronTaskCmd() *CronTaskCmd {
2 years ago
return &CronTaskCmd{NewRootCmd("cronTask")}
2 years ago
}
2 years ago
func (c *CronTaskCmd) addRunE(f func() error) {
2 years ago
c.Command.RunE = func(cmd *cobra.Command, args []string) error {
return f()
}
}
2 years ago
func (c *CronTaskCmd) Exec(f func() error) error {
c.addRunE(f)
return c.Execute()
}