Merge "Document when sample_default is in use"
This commit is contained in:
commit
76fd7231cb
@ -321,6 +321,14 @@ class _OptFormatter(object):
|
|||||||
'# effect on stability and/or performance.\n'
|
'# effect on stability and/or performance.\n'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if opt.sample_default:
|
||||||
|
lines.append(
|
||||||
|
'#\n'
|
||||||
|
'# This option has a sample default set, which means that\n'
|
||||||
|
'# its actual default value may vary from the one documented\n'
|
||||||
|
'# below.\n'
|
||||||
|
)
|
||||||
|
|
||||||
if hasattr(opt.type, 'format_defaults'):
|
if hasattr(opt.type, 'format_defaults'):
|
||||||
defaults = opt.type.format_defaults(opt.default,
|
defaults = opt.type.format_defaults(opt.default,
|
||||||
opt.sample_default)
|
opt.sample_default)
|
||||||
|
@ -142,6 +142,16 @@ def _format_opt(opt, group_name):
|
|||||||
yield _indent(
|
yield _indent(
|
||||||
'effect on stability and/or performance.', 6)
|
'effect on stability and/or performance.', 6)
|
||||||
|
|
||||||
|
if opt.sample_default:
|
||||||
|
yield _indent(
|
||||||
|
'')
|
||||||
|
yield _indent(
|
||||||
|
'This option has a sample default set, which means that')
|
||||||
|
yield _indent(
|
||||||
|
'its actual default value may vary from the one documented')
|
||||||
|
yield _indent(
|
||||||
|
'above.')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
help_text = opt.help % {'default': 'the value above'}
|
help_text = opt.help % {'default': 'the value above'}
|
||||||
except (TypeError, KeyError, ValueError):
|
except (TypeError, KeyError, ValueError):
|
||||||
|
@ -811,6 +811,10 @@ class GeneratorTestCase(base.BaseTestCase):
|
|||||||
#
|
#
|
||||||
|
|
||||||
# multiple strings (multi valued)
|
# multiple strings (multi valued)
|
||||||
|
#
|
||||||
|
# This option has a sample default set, which means that
|
||||||
|
# its actual default value may vary from the one documented
|
||||||
|
# below.
|
||||||
#multi_opt = 5
|
#multi_opt = 5
|
||||||
#multi_opt = 6
|
#multi_opt = 6
|
||||||
''')),
|
''')),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user