Skip to content

Commit

Permalink
chore: make error returned by oras tag more readable
Browse files Browse the repository at this point in the history
Signed-off-by: Billy Zha <[email protected]>
  • Loading branch information
qweeah committed Aug 9, 2023
1 parent dcc112b commit 2d786f2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/oras/root/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/spf13/cobra"
"oras.land/oras-go/v2"
"oras.land/oras-go/v2/registry"
"oras.land/oras/cmd/oras/internal/display"
"oras.land/oras/cmd/oras/internal/option"
)
Expand Down Expand Up @@ -58,6 +59,9 @@ Example - Tag the manifest 'v1.0.1' to 'v1.0.2' in an OCI image layout folder 'l
Args: cobra.MinimumNArgs(2),
PreRunE: func(cmd *cobra.Command, args []string) error {
opts.RawReference = args[0]
if _, err := registry.ParseReference(opts.RawReference); err != nil {
return fmt.Errorf("unable to add tag for '%s': %w", opts.RawReference, err)
}
opts.targetRefs = args[1:]
return option.Parse(&opts)
},
Expand Down

0 comments on commit 2d786f2

Please sign in to comment.