github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/pkg/task/config.go (about) 1 package task 2 3 import "context" 4 5 type TaskRunOption func(o *taskRunConfig) 6 7 type HookFn func(context.Context) 8 9 type taskRunConfig struct { 10 preHooks []HookFn 11 runUpdateCheck bool 12 } 13 14 func newRunConfig() *taskRunConfig { 15 return &taskRunConfig{ 16 runUpdateCheck: true, 17 } 18 } 19 20 func WithUpdateCheck(run bool) TaskRunOption { 21 return func(o *taskRunConfig) { 22 o.runUpdateCheck = run 23 } 24 } 25 26 func WithPreHook(f HookFn) TaskRunOption { 27 return func(o *taskRunConfig) { 28 o.preHooks = append(o.preHooks, f) 29 } 30 }