src2asciidoc: Make sure usage lines are generated with fixed width

Due to a change in Python 3.8, the output depended on the calling terminal's
width. Set a fixed with of 200 (rather than 80) so that we always have the
expanded version for the generated documentation.

See #5393 and
74102c9a5f (diff-837b312b1f3508216ace6adb46492836)
This commit is contained in:
Florian Bruhin 2020-05-22 17:12:51 +02:00
parent abe16d5f06
commit bae1431703
2 changed files with 10 additions and 12 deletions

View File

@ -286,8 +286,7 @@ Set all settings back to their default.
[[config-cycle]]
=== config-cycle
Syntax: +:config-cycle [*--pattern* 'pattern'] [*--temp*] [*--print*]
'option' ['values' ['values' ...]]+
Syntax: +:config-cycle [*--pattern* 'pattern'] [*--temp*] [*--print*] 'option' ['values' ['values' ...]]+
Cycle an option between multiple values.
@ -608,8 +607,7 @@ Show help about a command or setting.
[[hint]]
=== hint
Syntax: +:hint [*--mode* 'mode'] [*--add-history*] [*--rapid*] [*--first*]
['group'] ['target'] ['args' ['args' ...]]+
Syntax: +:hint [*--mode* 'mode'] [*--add-history*] [*--rapid*] [*--first*] ['group'] ['target'] ['args' ['args' ...]]+
Start hinting.
@ -866,8 +864,7 @@ Do nothing.
[[open]]
=== open
Syntax: +:open [*--related*] [*--bg*] [*--tab*] [*--window*] [*--secure*] [*--private*]
['url']+
Syntax: +:open [*--related*] [*--bg*] [*--tab*] [*--window*] [*--secure*] [*--private*] ['url']+
Open a URL in the current/[count]th tab.
@ -1197,9 +1194,7 @@ Load a session.
[[session-save]]
=== session-save
Syntax: +:session-save [*--current*] [*--quiet*] [*--force*] [*--only-active-window*]
[*--with-private*]
['name']+
Syntax: +:session-save [*--current*] [*--quiet*] [*--force*] [*--only-active-window*] [*--with-private*] ['name']+
Save a session.
@ -1263,9 +1258,7 @@ Set a mark at the current scroll position in the current tab.
[[spawn]]
=== spawn
Syntax: +:spawn [*--userscript*] [*--verbose*] [*--output*] [*--output-messages*]
[*--detach*]
'cmdline'+
Syntax: +:spawn [*--userscript*] [*--verbose*] [*--output*] [*--output-messages*] [*--detach*] 'cmdline'+
Spawn an external command.

View File

@ -59,6 +59,11 @@ class UsageFormatter(argparse.HelpFormatter):
argparse.HelpFormatter while copying 99% of the code :-/
"""
def __init__(self, prog, indent_increment=2, max_help_position=24,
width=200):
"""Override __init__ to set a fixed width as default."""
super().__init__(prog, indent_increment, max_help_position, width)
def _format_usage(self, usage, actions, groups, _prefix):
"""Override _format_usage to not add the 'usage:' prefix."""
return super()._format_usage(usage, actions, groups, '')