# HG changeset patch # User Kyle Lippincott # Date 2021-02-12 19:04:03 # Node ID 921e1253c8ba97827e68fd98d2791978324d7dc6 # Parent cd91543431604b0fcaa601a3aa8b3c862f0d7c41 gendoc: support defaults on customopts a bit better Without this, a customopt will very likely render like this: ``` -foo does foo (default: ) ``` I copied this logic from how this is handled in mercurial/help.py. Differential Revision: https://phab.mercurial-scm.org/D9988 diff --git a/doc/gendoc.py b/doc/gendoc.py --- a/doc/gendoc.py +++ b/doc/gendoc.py @@ -31,6 +31,7 @@ from mercurial import ( commands, encoding, extensions, + fancyopts, help, minirst, pycompat, @@ -86,6 +87,8 @@ def get_opts(opts): if b'\n' in desc: # only remove line breaks and indentation desc = b' '.join(l.lstrip() for l in desc.split(b'\n')) + if isinstance(default, fancyopts.customopt): + default = default.getdefaultvalue() if default: default = stringutil.forcebytestr(default) desc += _(b" (default: %s)") % default