From 85b7302b6d78ab416dc6261b6b9a6ebd7699ad85 Mon Sep 17 00:00:00 2001 From: "Lixia (Sylvia) Lei" Date: Wed, 27 Nov 2024 17:02:26 +0800 Subject: [PATCH] minor refactor + todo Signed-off-by: Lixia (Sylvia) Lei --- cmd/oras/internal/option/common.go | 2 ++ internal/descriptor/descriptor.go | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/oras/internal/option/common.go b/cmd/oras/internal/option/common.go index d5949584b..39e839ed4 100644 --- a/cmd/oras/internal/option/common.go +++ b/cmd/oras/internal/option/common.go @@ -30,9 +30,11 @@ const NoTTYFlag = "no-tty" type Common struct { Debug bool noTTY bool + // Verbose is deprecated. Use SuppressUntitled instead. // SuppressUntitled=false is equivalent to Verbose=true, while Verbose=false // no longer takes effect. + // TODO: remove from common Verbose bool TTY *os.File diff --git a/internal/descriptor/descriptor.go b/internal/descriptor/descriptor.go index aba1a7456..741aa3c94 100644 --- a/internal/descriptor/descriptor.go +++ b/internal/descriptor/descriptor.go @@ -69,10 +69,10 @@ func Plain(desc ocispec.Descriptor) ocispec.Descriptor { // GetName gets a descriptor name using either title or media type. func GetName(desc ocispec.Descriptor) string { title, ok := desc.Annotations[ocispec.AnnotationTitle] - if !ok { - return desc.MediaType + if ok { + return title } - return title + return desc.MediaType } // GenerateContentKey generates a unique key for each content descriptor using