void-ptr974 opened a new issue, #26176:
URL: https://github.com/apache/pulsar/issues/26176

   ### What happened?
   
   The V5 scalable topic admin CLI accepts `-p` / `--property` for 
`scalable-topics create` and property-filtered `scalable-topics list`. The 
option is currently parsed as a greedy multi-value option, so natural commands 
that put `-p` before the required positional argument are parsed incorrectly.
   
   Examples:
   
   ```bash
   pulsar-admin scalable-topics create -p app=cli topic://public/default/t1
   pulsar-admin scalable-topics list -p app=cli public/default
   ```
   
   In these forms, the following positional `topic` or `namespace` is consumed 
as another `-p` value, and the command fails because the required positional 
parameter is reported as missing.
   
   ### Expected behavior
   
   Both option orderings should work:
   
   ```bash
   pulsar-admin scalable-topics create -p app=cli topic://public/default/t1
   pulsar-admin scalable-topics create topic://public/default/t1 -p app=cli
   pulsar-admin scalable-topics list -p app=cli public/default
   pulsar-admin scalable-topics list public/default -p app=cli
   ```
   
   It should also be possible to pass multiple properties without repeating 
`-p` excessively, for example:
   
   ```bash
   pulsar-admin scalable-topics create -p app=cli,mode=blackbox 
topic://public/default/t1
   pulsar-admin scalable-topics list -p app=cli,mode=blackbox public/default
   ```
   
   Repeated `-p key=value` should continue to work for compatibility with the 
existing CLI style.
   
   ### Actual behavior
   
   When `-p` / `--property` appears before the positional topic or namespace, 
picocli consumes the positional argument as an additional property value. The 
command then fails before reaching the admin API.
   
   ### Reproduction
   
   Run either of the following against a Pulsar build that includes the V5 
`scalable-topics` admin commands:
   
   ```bash
   pulsar-admin scalable-topics create -p app=cli topic://public/default/t1
   pulsar-admin scalable-topics list -p app=cli public/default
   ```
   
   The same commands work if `-p` is moved after the positional argument.
   
   ### Scope
   
   This is V5-specific. It affects the `pulsar-admin scalable-topics` CLI for 
scalable topics and does not affect the regular `topics` admin CLI.
   
   ### Suggested fix
   
   Make `-p` / `--property` a single-value repeatable option and expand 
comma-separated `key=value` entries inside each occurrence. Add CLI parser 
coverage for `create` and `list` with:
   
   - `-p` before the positional argument
   - `-p` after the positional argument
   - repeated `-p key=value`
   - comma-separated `-p key=value,key2=value2`
   
   I have a local patch and focused validation for this behavior.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to