feat: Add temp dir option (#2891)

Co-authored-by: Valentin Maerten <maerten.valentin@gmail.com>
This commit is contained in:
kjasn
2026-06-29 22:13:37 +08:00
committed by GitHub
parent f9e52fab40
commit 1c743de2b7
10 changed files with 99 additions and 8 deletions

View File

@@ -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 {