diff --git a/completion/bash/task.bash b/completion/bash/task.bash index 0b19329e..77617c72 100644 --- a/completion/bash/task.bash +++ b/completion/bash/task.bash @@ -22,7 +22,7 @@ function _task() # Handle special arguments of options. case "$prev" in - -d|--dir) + -d|--dir|--remote-cache-dir) _filedir -d return $? ;; diff --git a/completion/fish/task.fish b/completion/fish/task.fish index b2b9b045..8f72e6db 100644 --- a/completion/fish/task.fish +++ b/completion/fish/task.fish @@ -106,9 +106,10 @@ complete -c $GO_TASK_PROGNAME -s y -l yes -d 'assume yes t complete -c $GO_TASK_PROGNAME -n "__task_is_experiment_enabled GENTLE_FORCE" -l force-all -d 'force execution of task and all dependencies' # RemoteTaskfiles experiment - Options -complete -c $GO_TASK_PROGNAME -n "__task_is_experiment_enabled REMOTE_TASKFILES" -l offline -d 'use only local or cached Taskfiles' -complete -c $GO_TASK_PROGNAME -n "__task_is_experiment_enabled REMOTE_TASKFILES" -l timeout -d 'timeout for remote Taskfile downloads' -complete -c $GO_TASK_PROGNAME -n "__task_is_experiment_enabled REMOTE_TASKFILES" -l expiry -d 'cache expiry duration' +complete -c $GO_TASK_PROGNAME -n "__task_is_experiment_enabled REMOTE_TASKFILES" -l offline -d 'use only local or cached Taskfiles' +complete -c $GO_TASK_PROGNAME -n "__task_is_experiment_enabled REMOTE_TASKFILES" -l timeout -d 'timeout for remote Taskfile downloads' +complete -c $GO_TASK_PROGNAME -n "__task_is_experiment_enabled REMOTE_TASKFILES" -l expiry -d 'cache expiry duration' +complete -c $GO_TASK_PROGNAME -n "__task_is_experiment_enabled REMOTE_TASKFILES" -l remote-cache-dir -d 'directory to cache remote Taskfiles' -xa "(__fish_complete_directories)" # RemoteTaskfiles experiment - Operations complete -c $GO_TASK_PROGNAME -n "__task_is_experiment_enabled REMOTE_TASKFILES" -l download -d 'download remote Taskfile' diff --git a/completion/ps/task.ps1 b/completion/ps/task.ps1 index 941c1d48..46ef7bea 100644 --- a/completion/ps/task.ps1 +++ b/completion/ps/task.ps1 @@ -75,6 +75,7 @@ Register-ArgumentCompleter -CommandName task -ScriptBlock { $completions += [CompletionResult]::new('--offline', '--offline', [CompletionResultType]::ParameterName, 'use cached Taskfiles') $completions += [CompletionResult]::new('--timeout', '--timeout', [CompletionResultType]::ParameterName, 'download timeout') $completions += [CompletionResult]::new('--expiry', '--expiry', [CompletionResultType]::ParameterName, 'cache expiry') + $completions += [CompletionResult]::new('--remote-cache-dir', '--remote-cache-dir', [CompletionResultType]::ParameterName, 'cache directory') # Operations $completions += [CompletionResult]::new('--download', '--download', [CompletionResultType]::ParameterName, 'download remote Taskfile') $completions += [CompletionResult]::new('--clear-cache', '--clear-cache', [CompletionResultType]::ParameterName, 'clear cache') diff --git a/completion/zsh/_task b/completion/zsh/_task index 85a5dd1e..92fb637d 100755 --- a/completion/zsh/_task +++ b/completion/zsh/_task @@ -96,6 +96,7 @@ _task() { '(--offline --download)--offline[use only local or cached Taskfiles]' '(--timeout)--timeout[timeout for remote Taskfile downloads]:duration: ' '(--expiry)--expiry[cache expiry duration]:duration: ' + '(--remote-cache-dir)--remote-cache-dir[directory to cache remote Taskfiles]:cache dir:_dirs' ) fi diff --git a/internal/flags/flags.go b/internal/flags/flags.go index 22358938..ce9adf99 100644 --- a/internal/flags/flags.go +++ b/internal/flags/flags.go @@ -163,7 +163,7 @@ func init() { pflag.DurationVar(&Timeout, "timeout", getConfig(config, func() *time.Duration { return config.Remote.Timeout }, time.Second*10), "Timeout for downloading remote Taskfiles.") pflag.BoolVar(&ClearCache, "clear-cache", false, "Clear the remote cache.") pflag.DurationVar(&CacheExpiryDuration, "expiry", getConfig(config, func() *time.Duration { return config.Remote.CacheExpiry }, 0), "Expiry duration for cached remote Taskfiles.") - RemoteCacheDir = getConfig(config, func() *string { return config.Remote.CacheDir }, env.GetTaskEnv("REMOTE_DIR")) + pflag.StringVar(&RemoteCacheDir, "remote-cache-dir", getConfig(config, func() *string { return config.Remote.CacheDir }, env.GetTaskEnv("REMOTE_DIR")), "Directory to cache remote Taskfiles.") } pflag.Parse() } diff --git a/website/src/docs/experiments/remote-taskfiles.md b/website/src/docs/experiments/remote-taskfiles.md index 5f1e28f1..8e8a34c7 100644 --- a/website/src/docs/experiments/remote-taskfiles.md +++ b/website/src/docs/experiments/remote-taskfiles.md @@ -284,10 +284,11 @@ and look for a cached copy instead. This timeout can be configured by setting the `--timeout` flag and specifying a duration. For example, `--timeout 5s` will set the timeout to 5 seconds. -By default, the cache is stored in the Task temp directory, represented by the -`TASK_TEMP_DIR` environment variable. You can override the location of the cache -by setting the `TASK_REMOTE_DIR` environment variable. This way, you can share -the cache between different projects. +By default, the cache is stored in the Task temp directory (`.task`). You can +override the location of the cache by using the `--remote-cache-dir` flag, the +`remote.cache-dir` option in your [configuration file](#cache-dir), or the +`TASK_REMOTE_DIR` environment variable. This way, you can share the cache +between different projects. You can force Task to ignore the cache and download the latest version by using the `--download` flag. @@ -367,7 +368,8 @@ remote: - **Default**: `.task` - **Description**: Directory where remote Taskfiles are cached. Can be an absolute path (e.g., `/var/cache/task`) or relative to the Taskfile directory. -- **Environment variable**: `TASK_REMOTE_DIR` (lower priority than config file) +- **CLI equivalent**: `--remote-cache-dir` +- **Environment variable**: `TASK_REMOTE_DIR` (lowest priority) ```yaml remote: