From 687b3248dec04cfcff4743d2efdca659d203655a Mon Sep 17 00:00:00 2001 From: Terry Howe Date: Wed, 22 Feb 2023 08:36:48 -0700 Subject: [PATCH] Print requested reference tag Signed-off-by: Terry Howe --- cmd/oras/repository/tags.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/oras/repository/tags.go b/cmd/oras/repository/tags.go index 4389727f7..513ff24c9 100644 --- a/cmd/oras/repository/tags.go +++ b/cmd/oras/repository/tags.go @@ -56,7 +56,7 @@ Example - Show tags of the target OCI layout folder 'layout-dir': Example - Show tags of the target OCI layout archive 'layout.tar': oras repo tags --oci-layout layout.tar -Example - Show tags also associated with a particular tagged resource: +Example - Show tags associated with a particular tagged resource: oras repo tags localhost:5000/hello:latest Example - Show tags associated with a digest: @@ -104,6 +104,10 @@ func showTags(opts showTagsOptions) error { continue } if filter != "" { + if tag == opts.Reference { + fmt.Println(tag) + continue + } desc, err := finder.Resolve(ctx, tag) if err != nil { return err @@ -111,9 +115,6 @@ func showTags(opts showTagsOptions) error { if desc.Digest.String() != filter { continue } - if tag == opts.Reference { - continue - } } fmt.Println(tag) }