Skip to content

--format and --pretty should not be used at the same time for oras manifest fetch #1356

@qweeah

Description

@qweeah

What happened in your environment?

I can use --format and --pretty at the same time for oras manifest fetch

> oras manifest fetch localhost:5000/demo:eol --pretty --format json
{
  "ref": "localhost:5000/demo@sha256:8536ab80a4bfef21647eb36f0f17bac607c995149cc818c3a5b4dd8153cb7006",
  "mediaType": "application/vnd.oci.image.manifest.v1+json",
  "digest": "sha256:8536ab80a4bfef21647eb36f0f17bac607c995149cc818c3a5b4dd8153cb7006",
  "size": 535,
  "content": {
    "annotations": {
      "org.opencontainers.image.created": "2024-04-15T12:31:43Z"
    },
    "artifactType": "application/vnd.unknown.artifact.v1",
    "config": {
      "data": "e30=",
      "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
      "mediaType": "application/vnd.oci.empty.v1+json",
      "size": 2
    },
    "layers": [
      {
        "data": "e30=",
        "digest": "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
        "mediaType": "application/vnd.oci.empty.v1+json",
        "size": 2
      }
    ],
    "mediaType": "application/vnd.oci.image.manifest.v1+json",
    "schemaVersion": 2
  }
}

The --pretty is actually ignore since it only effects raw content output. The output of --format json is already designed to be prettified

What did you expect to happen?

Return error when --format and --pretty are used at the same time for command oras manifest fetch

How can we reproduce it?

Fetch a manifest with --format and --pretty.

What is the version of your ORAS CLI?

Version: 1.2.0-beta.1+unreleased
Go version: go1.22.1
Git commit: 2edebad

What is your OS environment?

Ubuntu 20.05

Are you willing to submit PRs to fix it?

  • Yes, I am willing to fix it.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions