Skip to content

Comments

tools - traffic_ctl, traffic_layout: use ArgParse groups to handle mutually exclusive options.#12623

Open
brbzull0 wants to merge 2 commits intoapache:masterfrom
brbzull0:argparser_groups_opts
Open

tools - traffic_ctl, traffic_layout: use ArgParse groups to handle mutually exclusive options.#12623
brbzull0 wants to merge 2 commits intoapache:masterfrom
brbzull0:argparser_groups_opts

Conversation

@brbzull0
Copy link
Contributor

@brbzull0 brbzull0 commented Oct 29, 2025

Make sure we express the intentions properly, using mutex groups from ArgParse.
#12621 needs to go in first, I'll leave this as draft till we get the first pr sorted. DONE

traffic_ctl:

Usage: traffic_ctl [OPTIONS] CMD [ARGS ...]

Commands ---------------------- Description -----------------------
drain                           Drain the requests

Options ======================= Default ===== Description =============

Group (drain_mode)
  -N, --no-new-connection                     Wait for new connections down to threshold before starting draining
  -U, --undo                                  Recover server from the drain mode

traffic_layout:

Usage: traffic_layout CMD [OPTIONS]

Commands ---------------------- Description -----------------------
info                            Show the layout as default

Options ======================= Default ===== Description =============
-j, --json                                    Produce output in JSON format (when supported)

Group (display_mode)
  --features                                  Show the compiled features
  --versions                                  Show various library and other versioning information

relates to #12605

@brbzull0 brbzull0 self-assigned this Oct 29, 2025
@brbzull0 brbzull0 added Tools traffic_ctl traffic_ctl related work. traffic_layout traffic_layout related work labels Oct 29, 2025
@brbzull0 brbzull0 added this to the 10.2.0 milestone Oct 29, 2025
@brbzull0
Copy link
Contributor Author

[approve ci]

@brbzull0 brbzull0 marked this pull request as ready for review November 11, 2025 09:47
@brbzull0
Copy link
Contributor Author

[approve ci autest 2]

mutually exclusive options.

traffic_ctl:

Usage: traffic_ctl [OPTIONS] CMD [ARGS ...]

Commands ---------------------- Description -----------------------
drain                           Drain the requests

Options ======================= Default ===== Description =============

Group (drain_mode)
  -N, --no-new-connection                     Wait for new connections down to threshold before starting draining
  -U, --undo                                  Recover server from the drain mode

traffic_layout:

Usage: traffic_layout CMD [OPTIONS]

Commands ---------------------- Description -----------------------
info                            Show the layout as default

Options ======================= Default ===== Description =============
-j, --json                                    Produce output in JSON format (when supported)

Group (display_mode)
  --features                                  Show the compiled features
  --versions                                  Show various library and other versioning information
@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. Marking it stale to flag it for further consideration by the community.

@github-actions github-actions bot added the Stale label Feb 17, 2026
@github-actions github-actions bot closed this Feb 24, 2026
@brbzull0 brbzull0 reopened this Feb 24, 2026
@brbzull0
Copy link
Contributor Author

[approve ci]

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements mutually exclusive option groups in two command-line tools (traffic_ctl and traffic_layout) using the new ArgParser mutex group feature from PR #12621. The changes ensure that conflicting options are properly validated and documented.

Changes:

  • Added mutex group for traffic_layout info command to make --features and --versions mutually exclusive
  • Added mutex group for traffic_ctl server drain command to make --no-new-connection and --undo mutually exclusive

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/traffic_layout/traffic_layout.cc Refactored info command to use mutex group for --features and --versions options, making them mutually exclusive display modes
src/traffic_ctl/traffic_ctl.cc Refactored server drain command to use mutex group for --no-new-connection and --undo options, making them mutually exclusive drain modes

@github-actions github-actions bot removed the Stale label Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tools traffic_ctl traffic_ctl related work. traffic_layout traffic_layout related work

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant