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

refactor: Move printer to output package #1394

Merged
merged 2 commits into from
Jun 12, 2024

Conversation

TerryHowe
Copy link
Member

@TerryHowe TerryHowe commented May 28, 2024

What this PR does / why we need it:

The printer is supposed to be a very generic output object and this change moves in that direction.

Copy link

codecov bot commented May 28, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 4 lines in your changes missing coverage. Please review.

Project coverage is 85.06%. Comparing base (8027e16) to head (c880581).

Files Patch % Lines
cmd/oras/root/cp.go 50.00% 0 Missing and 2 partials ⚠️
cmd/oras/internal/display/status/text.go 66.66% 0 Missing and 1 partial ⚠️
cmd/oras/internal/display/status/tty.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1394   +/-   ##
=======================================
  Coverage   85.06%   85.06%           
=======================================
  Files         107      107           
  Lines        3804     3804           
=======================================
  Hits         3236     3236           
  Misses        339      339           
  Partials      229      229           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TerryHowe TerryHowe force-pushed the refactor-display-package branch from 356b00b to 873d970 Compare May 28, 2024 22:57
@qweeah
Copy link
Contributor

qweeah commented Jun 4, 2024

@TerryHowe What kind of problem is expected to be resolved by this PR? Moving print-related utilities out of status folder is doable, but status package including the handlers should be placed side-by-side with metadata in the same folder level.

Types of output

  • Status output of the operation
  • Metadata output of the operation
  • Content output (non-relevant to this PR)

Taking pull artifact as an example:

  • Status output: progress bar
  • Metadata output: showing what has been pulled (e.g. filename, digest ...)
  • Content output: the artifact content save as a file (non-relevant to this PR)
$ oras pull --oci-layout hello:latest --no-tty
Downloading a948904f2f0f hello.txt
Downloaded  a948904f2f0f hello.txt
Pulled [oci-layout] hello:latest
Digest: sha256:6ca2cbb8dc842320c8b9ae609dfb2f9a83eb0be382cbc0c75c6bbdd51a15b242

Status output:

Downloading a948904f2f0f hello.txt
Downloaded  a948904f2f0f hello.txt

Metadata output:

Pulled [oci-layout] hello:latest
Digest: sha256:6ca2cbb8dc842320c8b9ae609dfb2f9a83eb0be382cbc0c75c6bbdd51a15b242

@TerryHowe
Copy link
Member Author

I just created this PR to give better separation of concerns and avoid possible circular dependencies. The Printer is a like a logging system and really shouldn't be dependent on what it logs.

@qweeah
Copy link
Contributor

qweeah commented Jun 5, 2024

@TerryHowe Got it, then this PR should only move print.go and print_test.go

@TerryHowe TerryHowe force-pushed the refactor-display-package branch from 873d970 to f75e979 Compare June 9, 2024 13:36
@TerryHowe TerryHowe changed the title refactor: Move handlers to handler package refactor: Move printer to output package Jun 9, 2024
Copy link
Contributor

@qweeah qweeah left a comment

Choose a reason for hiding this comment

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

LGTM

@qweeah qweeah merged commit 3291d32 into oras-project:main Jun 12, 2024
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants