You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ticktock.go 798 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package repl
  2. import "github.com/spf13/cobra"
  3. func init() {
  4. ttCmd := &cobra.Command{
  5. Use: "ticktock",
  6. Short: "ticktock command",
  7. }
  8. RootCmd.AddCommand(ttCmd)
  9. lsCmd := &cobra.Command{
  10. Use: "ls",
  11. Short: "list all jobs",
  12. Run: func(cmd *cobra.Command, args []string) {
  13. tickTockLs(GetCmdCtx(cmd))
  14. },
  15. }
  16. ttCmd.AddCommand(lsCmd)
  17. runCmd := &cobra.Command{
  18. Use: "run [jobName]",
  19. Short: "run job now",
  20. Args: cobra.ExactArgs(1),
  21. Run: func(cmd *cobra.Command, args []string) {
  22. tickTockRun(GetCmdCtx(cmd), args[0])
  23. },
  24. }
  25. ttCmd.AddCommand(runCmd)
  26. }
  27. func tickTockLs(ctx *CommandContext) {
  28. names := ctx.repl.tktk.GetJobNames()
  29. for _, name := range names {
  30. println(name)
  31. }
  32. }
  33. func tickTockRun(ctx *CommandContext, jobName string) {
  34. ctx.repl.tktk.RunNow(jobName)
  35. }

本项目旨在将云际存储公共基础设施化,使个人及企业可低门槛使用高效的云际存储服务(安装开箱即用云际存储客户端即可,无需关注其他组件的部署),同时支持用户灵活便捷定制云际存储的功能细节。