| 261 | type flagsOption struct{} |
| 262 | |
| 263 | func (o *flagsOption) ApplyToExecutor(e *task.Executor) { |
| 264 | // Set the sorter |
| 265 | var sorter sort.Sorter |
| 266 | switch TaskSort { |
| 267 | case "none": |
| 268 | sorter = sort.NoSort |
| 269 | case "alphanumeric": |
| 270 | sorter = sort.AlphaNumeric |
| 271 | } |
| 272 | |
| 273 | // Change the directory to the user's home directory if the global flag is set |
| 274 | dir := Dir |
| 275 | if Global { |
| 276 | home, err := os.UserHomeDir() |
| 277 | if err == nil { |
| 278 | dir = home |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | e.Options( |
| 283 | task.WithDir(dir), |
| 284 | task.WithEntrypoint(Entrypoint), |
| 285 | task.WithForce(Force), |
| 286 | task.WithForceAll(ForceAll), |
| 287 | task.WithInsecure(Insecure), |
| 288 | task.WithDownload(Download), |
| 289 | task.WithOffline(Offline), |
| 290 | task.WithTrustedHosts(TrustedHosts), |
| 291 | task.WithTimeout(Timeout), |
| 292 | task.WithCacheExpiryDuration(CacheExpiryDuration), |
| 293 | task.WithRemoteCacheDir(RemoteCacheDir), |
| 294 | task.WithCACert(CACert), |
| 295 | task.WithCert(Cert), |
| 296 | task.WithCertKey(CertKey), |
| 297 | task.WithWatch(Watch), |
| 298 | task.WithVerbose(Verbose), |
| 299 | task.WithSilent(Silent), |
| 300 | task.WithDisableFuzzy(DisableFuzzy), |
| 301 | task.WithAssumeYes(AssumeYes), |
| 302 | task.WithInteractive(Interactive), |
| 303 | task.WithDry(Dry || Status), |
| 304 | task.WithSummary(Summary), |
| 305 | task.WithParallel(Parallel), |
| 306 | task.WithColor(Color), |
| 307 | task.WithConcurrency(Concurrency), |
| 308 | task.WithInterval(Interval), |
| 309 | task.WithOutputStyle(Output), |
| 310 | task.WithTaskSorter(sorter), |
| 311 | task.WithVersionCheck(true), |
| 312 | task.WithFailfast(Failfast), |
| 313 | task.WithTempDirPath(TempDir), |
| 314 | ) |
| 315 | } |
| 316 | |
| 317 | // getConfig extracts a config value with priority: env var > taskrc config > fallback |
| 318 | func getConfig[T any](config *taskrcast.TaskRC, envKey string, fieldFunc func() *T, fallback T) T { |