Skip to content

pulsar-perf: improve error message for unrecognized options #18866

@pgier

Description

@pgier

Search before asking

  • I searched in the issues and found nothing similar.

Motivation

If I accidentally type a bad option when running the pulsar-perf command, I get an unhelpful error message.

> bin/pulsar-perf produce --foo mytopic
The size of topics list should be equal to --num-topic
Usage: pulsar-perf produce [options] persistent://prop/ns/my-topic
  Options:
    -am, --access-mode
      Producer access mode
      Default: Shared
...

I would expect pulsar-perf to provide an error that points out the bad option.

unrecognized option `--foo`

Solution

pulsar-perf should be able to determine if the user typed an option that is not valid.
I would think this would be handled automatically by the CLI library (jcommander in this case), but it seems to be interpreting unrecognized options as names of topics. If the CLI library can't handle this case correctly, pulsar should either switch to a different library, or add some additional error checking to see if an invalid option has been entered.

Alternatives

No response

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions