Skip to content

Commit

Permalink
chore: align naming of pack option to oras-go (#1073)
Browse files Browse the repository at this point in the history
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
  • Loading branch information
qweeah authored Aug 24, 2023
1 parent 6319416 commit 49f58ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions cmd/oras/internal/option/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ const (

// ImageSpec option struct.
type ImageSpec struct {
flag string
PackType oras.PackManifestVersion
flag string
PackVersion oras.PackManifestVersion
}

// Parse parses flags into the option.
func (opts *ImageSpec) Parse() error {
switch opts.flag {
case ImageSpecV1_1:
opts.PackType = oras.PackManifestVersion1_1_RC4
opts.PackVersion = oras.PackManifestVersion1_1_RC4
case ImageSpecV1_0:
opts.PackType = oras.PackManifestVersion1_0
opts.PackVersion = oras.PackManifestVersion1_0
default:
return fmt.Errorf("unknown image specification flag: %q", opts.flag)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/oras/root/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Example - Push file "hi.txt" into an OCI image layout folder 'layout-dir' with t
if err := option.Parse(&opts); err != nil {
return err
}
switch opts.PackType {
switch opts.PackVersion {
case oras.PackManifestVersion1_0:
if opts.manifestConfigRef != "" && opts.artifactType != "" {
return errors.New("--artifact-type and --config cannot both be provided for 1.0 OCI image")
Expand Down Expand Up @@ -161,7 +161,7 @@ func runPush(ctx context.Context, opts pushOptions) error {
packOpts.Layers = descs
memoryStore := memory.New()
pack := func() (ocispec.Descriptor, error) {
root, err := oras.PackManifest(ctx, memoryStore, opts.PackType, opts.artifactType, packOpts)
root, err := oras.PackManifest(ctx, memoryStore, opts.PackVersion, opts.artifactType, packOpts)
if err != nil {
return ocispec.Descriptor{}, err
}
Expand Down

0 comments on commit 49f58ab

Please sign in to comment.