Skip to content

gz-sim-model is broken with 2.2.0 <= CLI11 Version < 2.5.0 (gz-sim abusing of option and flags) #2918

@j-rivero

Description

@j-rivero

Coming from #2910 (comment).

When using CLI11 on Ubuntu Noble (version 2.4.2) the system is not able to handle our CLI options groups properly so the --list option always requires --model option.

I think that the root of the problem is that we are abusing of "options" and "flags" in CLI11 where a more natural approach would be to use "subcommand". The problem is that subcommands in CLI11 do not accept dashes so we can not keep our current parameters.

A subcommand possible implementation for gz-sim-model with two subcommands (list and model) would be:
https://gist.github.com/j-rivero/b4e332833440a85b463f66f9ee87524f

There is a breakage in the code when mixing options and flags and make one of the flags to require one of the options. This is the case now with the option "--model" that is being required by "--pose" so when trying to use the CLI executable without parameters or with "--list" the result is:

"--pose requires --model".

A quick workaround would be to stop making the flag to require the option and improve the description to reflect that.

Seems like CLI11 2.5.0 is able to deal with the current scenario.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions