From 6fa62462187c45a32c76d00d15a701307f464336 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
Date: Wed, 10 Aug 2016 16:04:30 +0200
Subject: [PATCH] main: make the help screen more help2html friendly
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Previously, it was the case that --list-dists was line-split on
the inner hyphen, which then subsequently got lost in the man page.
Also enquoted --help was not parsed as an option, so simply drop
the surrounding quotes.
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
---
main.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/clufter/main.py b/clufter/main.py
index 62d628e..a68bf76 100644
--- a/clufter/main.py
+++ b/clufter/main.py
@@ -216,6 +216,16 @@ class SharedHelpFormatter(IndentedHelpFormatter):
"""IndentedHelpFormatter to expand choices along defaults"""
choices_tag = "%choices"
+ def __init__(self, *args, **kwargs):
+ from textwrap import fill, wrap
+ IndentedHelpFormatter.__init__(self, *args, **kwargs)
+ tw = type('textwrap_mock', (object, ), dict(
+ fill=staticmethod(fill),
+ wrap=staticmethod(lambda *args, **kwargs:
+ wrap(*args, **dict(kwargs, break_on_hyphens=False)),
+ )))
+ self.format_option.func_globals['textwrap'] = tw
+
def expand_default(self, option):
ret = IndentedHelpFormatter.expand_default(self, option)
if isinstance(option, ExpertOption):
@@ -373,7 +383,7 @@ def run(argv=None, *args):
description_raw=cmds,
epilog='\n'.join(args2sgpl(
"To get help for given command, just precede or follow"
- " it with `--help'.",
+ " it with --help.",
*report_bugs
))
)
--
2.4.11