package bazel import "context" // Option controls instantiation of the [Bazel] command runner. type Option func(*options) type options struct { ctx context.Context configs []string bin string } // WithCtx sets the context used for the Bazel commands. Can be used to make // commands cancellable. By default a context wired up to signal handlers is // used. func WithCtx(ctx context.Context) Option { return func(o *options) { o.ctx = ctx } } // WithConfigProfiles sets the configuration profiles that will be passed to // Bazel via the `--config` flag. func WithConfigProfiles(cfgs ...string) Option { return func(o *options) { o.configs = append(o.configs, cfgs...) } } // WithBinary explicitly sets the path to the `bazel` binary. By default the // value of [Binary] is used. func WithBinary(bin string) Option { return func(o *options) { o.bin = bin } }