[Frontend] Only show the summary line of config docstrings in --help (#57357)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Harry Mellor
2026-09-17 12:53:11 +00:00
committed by GitHub
co-authored by Claude Opus 5
parent 8be3ca35f3
commit 0ef8366ba3
2 changed files with 35 additions and 7 deletions
+17
View File
@@ -524,3 +524,20 @@ def test_flat_product():
(3, 4, "a", 5, 6),
(3, 4, "b", 5, 6),
]
def test_group_description_is_summary_only():
"""Group descriptions are config docstrings, too long for the terminal."""
parser = FlexibleArgumentParser()
group = parser.add_argument_group(
title="MyConfig",
description="Summary line.\n\nDetails which only belong in the docs.",
)
group.add_argument("--my-arg")
assert "Summary line." in parser.format_help()
assert "only belong in the docs" not in parser.format_help()
parser._search_keyword = "myconfig"
assert "Summary line." in parser.format_help()
assert "only belong in the docs" not in parser.format_help()