Skip to content

Commit 4909b22

Browse files
authored
feat: show doc of variants after links (#82)
1 parent 7147389 commit 4909b22

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

dargs/dargs.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,16 @@ def gen_doc_flag(self, path: list[str] | None = None, **kwargs) -> str:
952952
choicedoc = indent("| possible choices: " + ", ".join(l_choice), INDENT)
953953
realdoc = indent(self.doc + "\n", INDENT) if self.doc else None
954954
anchor = make_rst_refid(arg_path) if kwargs.get("make_anchor") else None
955+
abstractdoc = indent(
956+
"\n".join(
957+
[
958+
f"* {ll}: {cc.doc}"
959+
for ll, cc in zip(l_choice, self.choice_dict.values())
960+
if cc.doc
961+
]
962+
),
963+
INDENT,
964+
)
955965
allparts = [
956966
anchor,
957967
headdoc,
@@ -960,6 +970,9 @@ def gen_doc_flag(self, path: list[str] | None = None, **kwargs) -> str:
960970
choicedoc,
961971
"",
962972
realdoc,
973+
"",
974+
abstractdoc,
975+
"",
963976
targetdoc,
964977
]
965978
return "\n".join([x for x in allparts if x is not None])

0 commit comments

Comments
 (0)