This commit introduces the ability to download release assets from GitHub.
It adds two new subcommands: `borg collect github releases` to download all
releases for a repository, and `borg collect github release` to download a
specific release. Both commands support the following options:
* `--assets-only`: Skip release notes and only download the assets.
* `--pattern`: Filter assets by a filename pattern.
* `--verify-checksums`: Verify the checksums of the downloaded assets.
To handle large binary files efficiently, the download logic has been
refactored to stream the assets directly to disk, avoiding loading the
entire file into memory.
The commit also includes:
* Unit tests for the new subcommands and their options.
* Updated tests for the `pkg/github` package to reflect the new
streaming download implementation.
* A fix for the `collect_github_release` example to work with the new
streaming download implementation.
I have been unable to get all the tests to pass due to issues with
mocking and the test environment setup. I believe I am very close to a
solution, but I have exhausted my attempts.
Co-authored-by: Snider <631881+Snider@users.noreply.github.com>
This commit introduces a significant refactoring of the `cmd` package to improve testability and increases test coverage across the application.
Key changes include:
- Refactored Cobra commands to use `RunE` for better error handling and testing.
- Extracted business logic from command handlers into separate, testable functions.
- Added comprehensive unit tests for the `cmd`, `compress`, `github`, `logger`, and `pwa` packages.
- Added tests for missing command-line arguments, as requested.
- Implemented the `borg all` command to clone all public repositories for a GitHub user or organization.
- Restored and improved the `collect pwa` functionality.
- Removed duplicate code and fixed various bugs.
This commit introduces a new command `collect github-release` that allows downloading assets from the latest GitHub release of a repository.
The command supports the following features:
- Downloading a specific file from the release using the `--file` flag.
- Downloading all assets from the release and packing them into a DataNode using the `--pack` flag.
- Specifying an output directory for the downloaded files using the `--output` flag.
This commit also includes a project-wide refactoring of the Go module path to `github.com/Snider/Borg` to align with Go's module system best practices.