From a67147abb126ef064864cb2cd067b8f859290bde Mon Sep 17 00:00:00 2001 From: Alessio Dionisi Date: Tue, 12 Sep 2023 14:24:01 +0200 Subject: [PATCH] feat: add an option to set a custom kustomize binary (#62) Signed-off-by: Alessio Dionisi --- runner.go | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/runner.go b/runner.go index a6e1072..4528199 100644 --- a/runner.go +++ b/runner.go @@ -58,18 +58,24 @@ func WithLogf(logf func(string, ...interface{})) Option { } } +func KustomizeBin(b string) Option { + return func(r *Runner) error { + r.KustomizeBinary = b + return nil + } +} + func New(opts ...Option) *Runner { r := &Runner{ - KustomizeBinary: "", - RunCommand: RunCommand, - CopyFile: CopyFile, - WriteFile: os.WriteFile, - ReadFile: os.ReadFile, - ReadDir: os.ReadDir, - Walk: filepath.Walk, - Exists: exists, - Logf: printf, - MakeTempDir: makeTempDir, + RunCommand: RunCommand, + CopyFile: CopyFile, + WriteFile: os.WriteFile, + ReadFile: os.ReadFile, + ReadDir: os.ReadDir, + Walk: filepath.Walk, + Exists: exists, + Logf: printf, + MakeTempDir: makeTempDir, } for i := range opts {