1
0
mirror of https://github.com/go-task/task.git synced 2025-10-30 23:58:01 +02:00

feat(remote): add a command to clear the cache (#1639)

* feat(remote): add a command to clear the cache

* Update cmd/task/task.go

Co-authored-by: Andrey Nering <andrey@nering.com.br>

* rebase

---------

Co-authored-by: Andrey Nering <andrey@nering.com.br>
This commit is contained in:
Valentin Maerten
2024-06-28 18:42:16 +02:00
committed by GitHub
parent a71020eab5
commit 76030c9146
4 changed files with 20 additions and 2 deletions

View File

@@ -65,6 +65,7 @@ var (
Experiments bool
Download bool
Offline bool
ClearCache bool
Timeout time.Duration
)
@@ -119,6 +120,7 @@ func init() {
pflag.BoolVar(&Download, "download", false, "Downloads a cached version of a remote Taskfile.")
pflag.BoolVar(&Offline, "offline", false, "Forces Task to only use local or cached Taskfiles.")
pflag.DurationVar(&Timeout, "timeout", time.Second*10, "Timeout for downloading remote Taskfiles.")
pflag.BoolVar(&ClearCache, "clear-cache", false, "Clear the remote cache.")
}
pflag.Parse()
@@ -129,6 +131,10 @@ func Validate() error {
return errors.New("task: You can't set both --download and --offline flags")
}
if Download && ClearCache {
return errors.New("task: You can't set both --download and --clear-cache flags")
}
if Global && Dir != "" {
log.Fatal("task: You can't set both --global and --dir")
return nil