Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce fetch command to get partial files #137

Merged
merged 1 commit into from
Mar 25, 2025
Merged

Conversation

chlins
Copy link
Contributor

@chlins chlins commented Mar 25, 2025

This pull request introduces a new fetch command to the modctl command-line tool, allowing users to fetch partial files from a remote repository. The most important changes include adding the fetch command implementation, updating the backend interface, and configuring the fetch operation.

New fetch command implementation:

  • cmd/fetch.go: Added a new fetch 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 new fetch command with the root command.

Backend updates:

  • pkg/backend/backend.go: Added a Fetch method to the Backend interface to support fetching partial files.
  • pkg/backend/fetch.go: Implemented the Fetch 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 new Fetch configuration struct with validation methods and default values.
  • pkg/backend/fetch_test.go: Added tests for the Fetch 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 the github.com/CloudNativeAI/modctl package and excluded the test/mocks directory from linting. [1] [2]
  • .golangci.yml: Modified the output format configuration to support multiple formats.

@chlins chlins added the enhancement New feature or request label Mar 25, 2025
Signed-off-by: chlins <chlins.zhang@gmail.com>
Copy link
Contributor

@gaius-qi gaius-qi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@gaius-qi gaius-qi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gaius-qi gaius-qi merged commit baf6f13 into main Mar 25, 2025
5 checks passed
@gaius-qi gaius-qi deleted the feat/fetch branch March 25, 2025 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants