Closed TerryHowe closed 3 months ago
Attention: Patch coverage is 91.48936%
with 4 lines
in your changes are missing coverage. Please review.
Project coverage is 82.04%. Comparing base (
f1d319f
) to head (fe953b1
).
Files | Patch % | Lines |
---|---|---|
cmd/oras/root/login.go | 66.66% | 1 Missing and 2 partials :warning: |
cmd/oras/root/discover.go | 87.50% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
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 oras push/attach --format xxx
which is designed to be used for automation. (There are also undergoing efforts for other commands, see #638) We have a draft doc https://hackmd.io/@shizh/HyFZkEcca to categorize all types of output in ORAS.
@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.
Fprintln
instead of Println
so we can pass a writer.cmd.OutOrStdout()
will always return os.Stdout
so no change in behavior The goal is to allow oras go scripting to be able to capture output from commands without messing with stdout
The goal is to allow oras go scripting to be able to capture output from commands without messing with stdout
The output of --format
won't go into STDOUT, e.g. localhost:5000/test@sha256:16ce5d4fb98496ec805e6b2401213598e710dbd936fb58cb7a325d2582924694
cannot captured by the go script.
> 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
The output of
--format
won't go into STDOUT, e.g.localhost:5000/test@sha256:16ce5d4fb98496ec805e6b2401213598e710dbd936fb58cb7a325d2582924694
cannot captured by the go script.
I'd sooner handle format as a follow up.
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: