-
Notifications
You must be signed in to change notification settings - Fork 181
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: Use cobra.Command.OutOrStdout method for output #1288
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1288 +/- ##
==========================================
+ Coverage 81.94% 82.04% +0.09%
==========================================
Files 83 83
Lines 4005 4016 +11
==========================================
+ Hits 3282 3295 +13
+ Misses 500 498 -2
Partials 223 223 ☔ View full report in Codecov by Sentry. |
Need to confirm which output should be covered in this PR. The proposed change in this PR doesn't cover all output of ORAS. E.g. the output of @TerryHowe Looks like you are trying to do automation and the target output to be changed is metadata and raw output? |
Thanks @TerryHowe . This is a big PR. From users' perspective, I am curious on what's the impact to ORAS CLI output. There is not an issue associated with this PR to describe the problem or enhancement. |
This change has no effect on the format of the output and from my understanding no effect on CLI output. The change is really just for go scripting.
|
The goal is to allow oras go scripting to be able to capture output from commands without messing with stdout |
The output of > oras version
Version: 1.2.0-beta.1
Go version: go1.21.6
Git commit: 9ffdb3eec60b969d842af1a9e699202e0827fa01
Git tree state: clean
> oras push localhost:5000/test:format --format {{.Ref}}
✓ Uploaded application/vnd.oci.empty.v1+json 2/2 B 100.00% 37ms
└─ sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
✓ Uploaded application/vnd.oci.image.manifest.v1+json 535/535 B 100.00% 0s
└─ sha256:16ce5d4fb98496ec805e6b2401213598e710dbd936fb58cb7a325d2582924694
localhost:5000/test@sha256:16ce5d4fb98496ec805e6b2401213598e710dbd936fb58cb7a325d2582924694 |
Signed-off-by: Terry Howe <tlhowe@amazon.com>
I'd sooner handle format as a follow up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What this PR does / why we need it:
This contains the command refactor I did in another PR.
With this change, the output of a command can be set to something other than stdout. For example capture the output of a command: