Skip to content

Support the creation of a mutually exclusive groups for ArgParser #12605

@brbzull0

Description

@brbzull0

With the change, ArgParser will make sure that only one of the arguments in the mutually exclusive group was present on the command line.

Right now you can have two command options that should be exclusively and handle them internally by checking one after another, the idea would be to have something like we have in python.

A clear example of this would be:

server_command.add_command("drain", "Drain the requests", [&]() { command->execute(); })
  .add_example_usage("traffic_ctl server drain [OPTIONS]")
  .add_option("--no-new-connection", "-N", "Wait for new connections...")
  .add_option("--undo", "-U", "Recover server from the drain mode");

They should be either one or the other, but there seems no way to express that atm.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions