generate_doc: Remove unneeded whitespace

This commit is contained in:
Florian Bruhin 2014-09-07 19:04:09 +02:00
parent a1fabcc5c2
commit 02292d8518
2 changed files with 8 additions and 12 deletions

View File

@ -30,7 +30,6 @@ It was inspired by other browsers/addons like dwb and Vimperator/Pentadactyl.
*'URL'*::
URLs to open on startup.
=== optional arguments
*-h*, *--help*::
show this help message and exit
@ -41,7 +40,6 @@ It was inspired by other browsers/addons like dwb and Vimperator/Pentadactyl.
*-V*, *--version*::
Show version and quit.
=== debug arguments
*-l* 'LOGLEVEL', *--loglevel* 'LOGLEVEL'::
Set loglevel
@ -81,9 +79,6 @@ It was inspired by other browsers/addons like dwb and Vimperator/Pentadactyl.
*--qt-qmljsdebugger* 'port:PORT[,block]'::
Activate the QML/JS debugger with a specified port. 'block' is optional and will make the application wait until a debugger connects to it.
// QUTE_OPTIONS_END
== BUGS

View File

@ -151,7 +151,7 @@ def _format_action(action):
for opt in action.option_strings:
parts.append('*{}* {}'.format(opt, args_string))
invocation = ', '.join(parts) + '::'
return '{}\n {}\n\n'.format(invocation, action.help)
return '{}\n {}\n'.format(invocation, action.help)
def generate_commands(f):
@ -293,19 +293,20 @@ def regenerate_manpage(filename):
"""Update manpage OPTIONS using an argparse parser."""
# pylint: disable=protected-access
parser = qutequtebrowser.get_argparser()
options = []
groups = []
# positionals, optionals and user-defined groups
for group in parser._action_groups:
options.append('=== {}\n'.format(group.title))
groupdata = []
groupdata.append('=== {}'.format(group.title))
if group.description is not None:
options.append(group.description + '\n')
groupdata.append(group.description)
for action in group._group_actions:
options.append(_format_action(action))
options.append('\n')
groupdata.append(_format_action(action))
groups.append('\n'.join(groupdata))
options = '\n'.join(groups)
# epilog
if parser.epilog is not None:
options.append(parser.epilog)
options.append('\n')
_format_block(filename, 'options', options)