Skip to content

discover: --output deprecation message suggests an empty --format #2296

Description

@ogulcanaydogan

What happened in your environment?

oras discover with the deprecated -o/--output flag prints a deprecation message that suggests --format with an empty value:

$ oras discover -o json localhost:5000/hello:v1
[DEPRECATED] --output is deprecated, try `--format ` instead

The same happens for -o tree and -o table. The message is built with opts.Template (cmd/oras/root/discover.go), which is only set for the go-template format, instead of the parsed format type. The switch a few lines above already uses opts.Format.Type.

I found this by reading the code and checked it with a unit test that runs the command's PreRunE and captures stderr, not against a registry.

What did you expect to happen?

[DEPRECATED] --output is deprecated, try `--format json` instead

How can we reproduce it?

Run oras discover -o json <reference> (the message is printed before any registry request), or the unit test in the linked PR.

What is the version of your ORAS CLI?

main (e84a5d3)

What is your OS environment?

macOS

Are you willing to submit PRs to fix it?

Yes, I opened a PR with the one line fix and a test.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions