Skip to content

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

Closed

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.

Activity

  1. added
    bug
    triage
    on Apr 18, 2024
  2. added this to the v1.2.0-rc.1 milestone on Apr 18, 2024
  3. qweeah commented on Apr 18, 2024

    @qweeah
    ContributorAuthor

    @wangxiaoxuan273 Can you help take a look at this issue since you are already working on refactoring the utilities function of flag conflict detection?

  4. removed
    triage
    on Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions