Skip to content

Commit

Permalink
chore: clean code of json metadata output for attach
Browse files Browse the repository at this point in the history
Signed-off-by: Billy Zha <[email protected]>
  • Loading branch information
qweeah committed Dec 11, 2024
1 parent 8fc2cfa commit 83a8be4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/oras/internal/display/metadata/json/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (

// AttachHandler handles json metadata output for attach events.
type AttachHandler struct {
out io.Writer
target *option.Target
root ocispec.Descriptor
out io.Writer
path string
root ocispec.Descriptor
}

// NewAttachHandler creates a new handler for attach events.
Expand All @@ -41,11 +41,11 @@ func NewAttachHandler(out io.Writer) metadata.AttachHandler {

// OnAttached implements AttachHandler.
func (ah *AttachHandler) OnAttached(target *option.Target, root ocispec.Descriptor, _ ocispec.Descriptor) {
ah.target = target
ah.path = target.Path
ah.root = root
}

// Render is called when the attach command is completed.
func (ah *AttachHandler) Render() error {
return output.PrintPrettyJSON(ah.out, model.NewAttach(ah.root, ah.target.Path))
return output.PrintPrettyJSON(ah.out, model.NewAttach(ah.root, ah.path))
}

0 comments on commit 83a8be4

Please sign in to comment.