Skip to content
Snippets Groups Projects
Commit 921e1253 authored by Kyle Lippincott's avatar Kyle Lippincott
Browse files

gendoc: support defaults on customopts a bit better

Without this, a customopt will very likely render like this:

```
-foo   does foo (default: <hgext.myextension.MyOpt object at 0x7f31...>)
```

I copied this logic from how this is handled in mercurial/help.py.

Differential Revision: https://phab.mercurial-scm.org/D9988
parent cd915434
No related branches found
No related tags found
1 merge request!72ci: hook network-io tests into the pipeline
......@@ -31,6 +31,7 @@
commands,
encoding,
extensions,
fancyopts,
help,
minirst,
pycompat,
......@@ -86,6 +87,8 @@
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment