package repl

import "github.com/spf13/cobra"

func init() {
	ttCmd := &cobra.Command{
		Use:   "ticktock",
		Short: "ticktock command",
	}
	RootCmd.AddCommand(ttCmd)

	runCmd := &cobra.Command{
		Use:   "run [jobName]",
		Short: "run job now",
		Args:  cobra.ExactArgs(1),
		Run: func(cmd *cobra.Command, args []string) {
			tickTockRun(GetCmdCtx(cmd), args[0])
		},
	}
	ttCmd.AddCommand(runCmd)
}

func tickTockRun(ctx *CommandContext, jobName string) {
	ctx.repl.tktk.RunNow(jobName)
}
