Skip to content

Commit b8de954

Browse files
scpetersiche033
andauthored
gz-sim-model: workaround cli11 bug (#2921)
There is a bug in cli11 for versions >= 2.2 and < 2.5. This works around the bug for the affected versions. Signed-off-by: Steve Peters <scpeters@openrobotics.org> Co-authored-by: Ian Chen <ichen@openrobotics.org>
1 parent 57d1311 commit b8de954

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/cmd/model_main.cc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,17 @@ void addModelFlags(CLI::App &_app)
145145
->expected(0, 1)
146146
->default_val("");
147147

148-
command->add_flag("-p,--pose", opt->pose,
149-
"Print the pose of the model.")
150-
->needs(modelCmd);
148+
auto poseOption =
149+
command->add_flag("-p,--pose", opt->pose,
150+
"Print the pose of the model (only useful with --model).");
151+
// Don't specify that it needs --model for cli11 >= 2.2.0, < 2.5
152+
// See https://github.com/gazebosim/gz-sim/issues/2918
153+
if (!(CLI11_VERSION_MAJOR == 2 &&
154+
CLI11_VERSION_MINOR >= 2 &&
155+
CLI11_VERSION_MINOR < 5))
156+
{
157+
poseOption->needs(modelCmd);
158+
}
151159

152160
_app.callback([opt](){ runModelCommand(*opt); });
153161
}

0 commit comments

Comments
 (0)