mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Output all option variant names in manual
This commit is contained in:
parent
215a446575
commit
e6eff0f6cf
@ -195,15 +195,14 @@ def render_options(cmd, groups, options_header=True, add_program=True, header_le
|
|||||||
lines.append('')
|
lines.append('')
|
||||||
if desc:
|
if desc:
|
||||||
lines.extend([desc, ''])
|
lines.extend([desc, ''])
|
||||||
for opt in sorted(options, cmp=lambda x, y:cmp(x.get_opt_string(),
|
for opt in sorted(options, key=lambda x: x.get_opt_string()):
|
||||||
y.get_opt_string())):
|
|
||||||
help = opt.help if opt.help else ''
|
help = opt.help if opt.help else ''
|
||||||
help = help.replace('\n', ' ').replace('*', '\\*').replace('%default', str(opt.default))
|
help = help.replace('\n', ' ').replace('*', '\\*').replace('%default', str(opt.default))
|
||||||
help = help.replace('"', r'\ ``"``\ ')
|
help = help.replace('"', r'\ ``"``\ ')
|
||||||
help = help.replace("'", r"\ ``'``\ ")
|
help = help.replace("'", r"\ ``'``\ ")
|
||||||
help = mark_options(help)
|
help = mark_options(help)
|
||||||
opt = opt.get_opt_string() + ((', '+', '.join(opt._short_opts)) if opt._short_opts else '')
|
opt_strings = (x.strip() for x in tuple(opt._long_opts or ()) + tuple(opt._short_opts or ()))
|
||||||
opt = '.. option:: '+opt
|
opt = '.. option:: ' + ', '.join(opt_strings)
|
||||||
lines.extend([opt, '', ' '+help, ''])
|
lines.extend([opt, '', ' '+help, ''])
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user