feat: introduce fetch command to get partial files #137
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.
This pull request introduces a new
fetch
command to themodctl
command-line tool, allowing users to fetch partial files from a remote repository. The most important changes include adding thefetch
command implementation, updating the backend interface, and configuring the fetch operation.New
fetch
command implementation:cmd/fetch.go
: Added a newfetch
command with various flags for configuration, including concurrency, plain HTTP, insecure connection, proxy, output directory, and patterns. The command validates the configuration and runs the fetch operation.cmd/root.go
: Registered the newfetch
command with the root command.Backend updates:
pkg/backend/backend.go
: Added aFetch
method to theBackend
interface to support fetching partial files.pkg/backend/fetch.go
: Implemented theFetch
method, which handles the fetching of partial files based on specified patterns, using a remote repository and supporting various configurations such as proxy and concurrency.Configuration and testing:
pkg/config/fetch.go
: Added a newFetch
configuration struct with validation methods and default values.pkg/backend/fetch_test.go
: Added tests for theFetch
method to ensure it correctly handles various scenarios, including pattern matching and invalid references.Linter configuration:
.golangci.yml
: Updated the linter configuration to include a new prefix for thegithub.com/CloudNativeAI/modctl
package and excluded thetest/mocks
directory from linting. [1] [2].golangci.yml
: Modified the output format configuration to support multiple formats.