oras
oras copied to clipboard
feat: add `fetch` command to get manifest of an artifact
This PR adds an new command manifest and a subcommand fetch for displaying the manifest of an artifact reference with below changes:
-
Moves
manifestrelated code into a new folder. Cobra related code should be put in thecmd.goand functional code should be put in the<sub-command-name>.go. This practice can be applied when we have more sub-commands inblobandrepositoryin the future. -
Adds a new mocking package to mock repository level operations (e.g. fetch, fetch reference, resolve), add used it for unit testing.
Resolves #301, #463
~~Convert to draft since we still need to support --platform and that need some work.~~ It's done.
Codecov Report
Merging #449 (2ac5fce) into main (e9810a8) will increase coverage by
3.92%. The diff coverage is100.00%.
@@ Coverage Diff @@
## main #449 +/- ##
==========================================
+ Coverage 67.58% 71.50% +3.92%
==========================================
Files 7 9 +2
Lines 327 372 +45
==========================================
+ Hits 221 266 +45
Misses 85 85
Partials 21 21
| Impacted Files | Coverage Δ | |
|---|---|---|
| cmd/oras/internal/option/platform.go | 100.00% <100.00%> (ø) |
|
| internal/cas/fetch.go | 100.00% <100.00%> (ø) |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
This PR is still pending on https://github.com/oras-project/oras-go/pull/244