mirror of
https://github.com/go-task/task.git
synced 2026-07-09 06:55:14 +00:00
feat: Add temp dir option (#2891)
Co-authored-by: Valentin Maerten <maerten.valentin@gmail.com>
This commit is contained in:
17
executor.go
17
executor.go
@@ -29,6 +29,7 @@ type (
|
||||
Dir string
|
||||
Entrypoint string
|
||||
TempDir TempDir
|
||||
TempDirPath string
|
||||
Force bool
|
||||
ForceAll bool
|
||||
Insecure bool
|
||||
@@ -165,6 +166,22 @@ func (o *tempDirOption) ApplyToExecutor(e *Executor) {
|
||||
e.TempDir = o.tempDir
|
||||
}
|
||||
|
||||
// WithTempDirPath sets an unresolved path used to build [Executor.TempDir]
|
||||
// during [Executor.Setup]. Relative paths are resolved from the root Taskfile
|
||||
// directory. Use [WithTempDir] when the remote and fingerprint directories have
|
||||
// already been resolved.
|
||||
func WithTempDirPath(path string) ExecutorOption {
|
||||
return &tempDirPathOption{path: path}
|
||||
}
|
||||
|
||||
type tempDirPathOption struct {
|
||||
path string
|
||||
}
|
||||
|
||||
func (o *tempDirPathOption) ApplyToExecutor(e *Executor) {
|
||||
e.TempDirPath = o.path
|
||||
}
|
||||
|
||||
// WithForce ensures that the [Executor] always runs a task, even when
|
||||
// fingerprinting or prompts would normally stop it.
|
||||
func WithForce(force bool) ExecutorOption {
|
||||
|
||||
Reference in New Issue
Block a user