**WIP:** feat: cache mode command
#1597
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instead of building
cache modelogic repeatedly for each platform (Github, GitLab, etc), as I've been doing previously #46 #44, this PR moves it under thensccommand, which each runner will always have installed.More cache mode providers can be easily added, by implementing the
mode.Providerinterface. For now, this PR implements a couple to show how it works, if accepted, follow on PRs can add full support.List modes:
Outputs the full list of all support cache modes.
Output mode(s):
Outputs the paths that should be cached for the selected modes.
$ nsc cache mode output /some/dir /some/dir $ nsc cache mode output --output json { "go": { "paths": [ "/some/dir" ] }, "golangci-lint": { "paths": [ "/some/dir" ] } } $ nsc cache mode output --output json --filter go { "go": { "paths": [ "/some/dir" ] } }Detect modes:
Using similar logic to namespacelabs/nscloud-cache-action#44 this command will try to detect which cache modes apply to the directory supplied (or working directory, if none).