[Bug🐛] Two option long names contain spaces and cannot be typed by a user

Open
#10,765 1 comment 0 reactions 1 assignee View on GitHub

@shubhambhar007 is already working on this.

Since Sep 19, 2026.

Assessment

This issue has not been assessed yet.

Description

bug🐛 Difficulty level/Easy good first issue help wanted rocketmq-tools crate rust
Prerequisites
  • I have searched existing issues and discussions
  • This is a bug, not a question (use Discussions for questions)
Environment
  • OS: any
  • RocketMQ Rust: main branch, commit 776518531
  • Rust: per workspace toolchain in rust-toolchain.toml
Bug Description

Two clap arguments register a long option name that contains a space. A shell
splits --list format into two separate tokens, so clap never sees a single
long flag with that name and the option cannot be used in its long form.

// rocketmq-tools/rocketmq-admin/rocketmq-admin-cli/src/commands/topic/topic_route_sub_command.rs line 37
    #[arg(short = 'l', long = "list format", required = false, help = "list format")]
    list_format: Option<bool>,
// rocketmq-tools/rocketmq-admin/rocketmq-admin-cli/src/commands/consumer/consumer_status_sub_command.rs line 46
        short = 'n',
        long = "name server address",
        required = false,
        help = "input name server address"

These are the only two long names in the crate that contain a space. Every other
command names this argument namesrvAddr, for example
rocketmq-admin-cli/src/commands.rs line 84, so a user who types the
conventional --namesrvAddr gets a usage error. The long help text is also
misleading: "list format" repeats the flag name instead of describing it.

list_format is additionally typed Option<bool>, which requires a value, so
plain -l (the Apache RocketMQ Java admin spelling) is a usage error too.

Steps to Reproduce
cargo run -p rocketmq-admin-cli -- topic topicRoute -t TopicTest --list format
cargo run -p rocketmq-admin-cli -- consumer consumerStatus --name server address 127.0.0.1:9876

Both fail with a usage error, even though the flags are declared.

Expected vs Actual

Expected: the long form of each option can be passed on the command line,
and the help text describes what the option does.

Actual: --list format and --name server address are rejected as
unrecognized arguments, so only the short forms -l and -n are reachable.

Logs/Screenshots
$ rocketmq-admin-cli topic topicRoute -t TopicTest --list format
ERROR core.argument.invalid: Argument is invalid
$ echo $?
64

$ rocketmq-admin-cli consumer consumerStatus --name server address 127.0.0.1:9876
ERROR core.argument.invalid: Argument is invalid
$ echo $?
64

--help shows the broken long name and, for list_format, the value requirement:

$ rocketmq-admin-cli topic topicRoute --help
Options:
  -n, --namesrvAddr <NAMESRV_ADDR>
          Name server address list, eg: '192.168.0.1:9876;192.168.0.2:9876'
  ...
  -l, --list format <LIST_FORMAT>
          list format

          [possible values: true, false]

Note that the same topicRoute command already spells its address flag
--namesrvAddr, so the consumer command is the one that deviates.

Additional Context

Pick the long names the rest of the crate already uses:
--namesrvAddr for the consumer command, and a single word such as
--listFormat (or --list-format) for the topic route command. Whichever you
pick, use the same spelling in the help text and in the flag itself.

Two decisions belong to the maintainers, so keep them out of this change unless
they are confirmed in the issue thread:

  • whether list_format should stay Option<bool> (a value is required) or
    become a plain bool flag so that -l alone works;
  • whether the old spaced names must keep working as hidden aliases for backward
    compatibility.

If the answer to either is "yes", say so in the pull request rather than
expanding the change.

Acceptance Criteria

  • Neither file declares a long value containing a space.
  • The --namesrvAddr spelling on the consumer command matches the spelling
    used elsewhere in the crate.
  • A new or extended test in the same file parses the long form successfully,
    so the regression cannot come back.
  • Any alias kept for compatibility is covered by a test as well.

Validation

Run from the repository root:

cargo fmt -p rocketmq-admin-cli -- --check
cargo test -p rocketmq-admin-cli
cargo run -p rocketmq-admin-cli -- topic topicRoute --help
cargo run -p rocketmq-admin-cli -- consumer consumerStatus --help

The --help runs are the quickest way to confirm the long name is spelled the
way you intend, since clap prints the registered long form.

Dominant language
Rust
Stars
1.5k
Forks
264
Avg merge
1h 34m
Merged PRs (30d)
567

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mxsm/rocketmq-rust

All issues in mxsm/rocketmq-rust

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.