diff --git a/src/traffic_ctl/traffic_ctl.cc b/src/traffic_ctl/traffic_ctl.cc index 5599bd64c9a..b094e6649ac 100644 --- a/src/traffic_ctl/traffic_ctl.cc +++ b/src/traffic_ctl/traffic_ctl.cc @@ -177,11 +177,15 @@ main([[maybe_unused]] int argc, const char **argv) // server commands server_command.add_command("backtrace", "Show a full stack trace of the traffic_server process", [&]() { CtrlUnimplementedCommand("backtrace"); }); - server_command.add_command("status", "Show the proxy status", Command_Execute).add_example_usage("traffic_ctl server status"); - 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 down to threshold before starting draining") - .add_option("--undo", "-U", "Recover server from the drain mode"); + server_command.add_command("status", "Show the proxy status", [&]() { command->execute(); }) + .add_example_usage("traffic_ctl server status"); + auto &drain_cmd = server_command.add_command("drain", "Drain the requests", [&]() { command->execute(); }); + drain_cmd.add_example_usage("traffic_ctl server drain [OPTIONS]"); + + drain_cmd.add_mutex_group("drain_mode", false, "Drain mode options"); + drain_cmd.add_option_to_group("drain_mode", "--no-new-connection", "-N", + "Wait for new connections down to threshold before starting draining"); + drain_cmd.add_option_to_group("drain_mode", "--undo", "-U", "Recover server from the drain mode"); auto &debug_command = server_command.add_command("debug", "Enable/Disable ATS for diagnostic messages at runtime").require_commands(); diff --git a/src/traffic_layout/traffic_layout.cc b/src/traffic_layout/traffic_layout.cc index fa28fb5ef29..dcd1465dd47 100644 --- a/src/traffic_layout/traffic_layout.cc +++ b/src/traffic_layout/traffic_layout.cc @@ -45,11 +45,12 @@ main([[maybe_unused]] int argc, const char **argv) .add_option("--version", "-V", "Print version string"); // info command - engine.parser.add_command("info", "Show the layout as default", [&]() { engine.info(); }) - .add_option("--features", "", "Show the compiled features") - .add_option("--versions", "", "Show various library and other versioning information") - .add_option("--json", "-j", "Produce output in JSON format (when supported)") - .set_default(); + auto &info_cmd = engine.parser.add_command("info", "Show the layout as default", [&]() { engine.info(); }); + info_cmd.add_mutex_group("display_mode", false, "Display mode options"); + info_cmd.add_option_to_group("display_mode", "--features", "", "Show the compiled features"); + info_cmd.add_option_to_group("display_mode", "--versions", "", "Show various library and other versioning information"); + + info_cmd.add_option("--json", "-j", "Produce output in JSON format (when supported)").set_default(); // init command engine.parser.add_command("init", "Initialize(create) the runroot sandbox", [&]() { engine.create_runroot(); }) .add_option("--absolute", "-a", "Produce absolute path in the runroot.yaml")