Skip to content

Commit

Permalink
Support colons in the parser's format_usage() output.
Browse files Browse the repository at this point in the history
The split around ":" only needs to separate the automatic "usage:" prefix, not
any colons (for example in "HOST:PORT" strings) that happen to be in the
output. Split just once to ensure this.
  • Loading branch information
ckreibich authored and praiskup committed Sep 9, 2023
1 parent ffb0383 commit 6847721
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion argparse_manpage/manpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def __init__(self, parser, _data=None, format='pretty'):

self.formatter = self.parser._get_formatter()
self.mf = _ManpageFormatter(self.prog, self.formatter, format=self.format)
self.synopsis = self.parser.format_usage().split(':')[-1].split()
self.synopsis = self.parser.format_usage().split(':', 1)[-1].split()

self.date = self._data.get("date")
if not self.date:
Expand Down

0 comments on commit 6847721

Please sign in to comment.