1package jobs23import (4 "context"5 "sync"67 "github.com/spf13/cobra"8)910// Job is a job that can be registered with the scheduler.11type Job struct {12 ID int13 Runner Runner14}1516// Runner is a job runner.17type Runner interface {18 Spec(context.Context) string19 Command() *cobra.Command20}2122var (23 mtx sync.Mutex24 jobs = make(map[string]*Job, 0)25)2627// Register registers a job.28func Register(name string, runner Runner) {29 mtx.Lock()30 defer mtx.Unlock()31 jobs[name] = &Job{Runner: runner}32}3334// List returns a map of registered jobs.35func List() map[string]*Job {36 mtx.Lock()37 defer mtx.Unlock()38 return jobs39}