summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2010-05-25 10:19:30 +0200
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2010-05-25 10:19:30 +0200
commit3d9db7d8d5ba6749848e80dd72947e120835aafd (patch)
treea230486ff8f60ac28fb83dbc22337bbe6645e296
parentef7df8b092cc848430f6ba0627e51d9e05a0929d (diff)
downloadlogilab-common-3d9db7d8d5ba6749848e80dd72947e120835aafd.tar.gz
[configuration] handle level for man page generation
-rw-r--r--configuration.py3
-rw-r--r--optik_ext.py3
2 files changed, 4 insertions, 2 deletions
diff --git a/configuration.py b/configuration.py
index 2170974..e781bf1 100644
--- a/configuration.py
+++ b/configuration.py
@@ -573,7 +573,8 @@ class OptionsManagerMixIn(object):
self._monkeypatch_expand_default()
try:
optparse.generate_manpage(self.cmdline_parser, pkginfo,
- section, stream=stream or sys.stdout)
+ section, stream=stream or sys.stdout,
+ level=self._maxlevel)
finally:
self._unmonkeypatch_expand_default()
diff --git a/optik_ext.py b/optik_ext.py
index 94a0f35..3245db0 100644
--- a/optik_ext.py
+++ b/optik_ext.py
@@ -370,9 +370,10 @@ Please report bugs on the project\'s mailing list:
pkginfo.mailinglist, pkginfo.author, pkginfo.author_email)
-def generate_manpage(optparser, pkginfo, section=1, stream=sys.stdout):
+def generate_manpage(optparser, pkginfo, section=1, stream=sys.stdout, level=0):
"""generate a man page from an optik parser"""
formatter = ManHelpFormatter()
+ formatter.output_level = level
formatter.parser = optparser
print >> stream, formatter.format_head(optparser, pkginfo, section)
print >> stream, optparser.format_option_help(formatter)