summaryrefslogtreecommitdiff
path: root/optik_ext.py
diff options
context:
space:
mode:
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>2008-11-14 13:09:51 +0100
committerNicolas Chauvat <nicolas.chauvat@logilab.fr>2008-11-14 13:09:51 +0100
commit1b7fe6a5fc9b101a46e9bda27b6f206d11b6cfe9 (patch)
treea720d620590c979664886d9ed32ed71685342ac4 /optik_ext.py
parent871009629bdc1c55709470a4d5bb36a7a38c41e1 (diff)
parent75f1b62191d9f294b6c518b482ec050feae05140 (diff)
downloadlogilab-common-1b7fe6a5fc9b101a46e9bda27b6f206d11b6cfe9.tar.gz
Diffstat (limited to 'optik_ext.py')
-rw-r--r--optik_ext.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/optik_ext.py b/optik_ext.py
index 123a2a6..2074fe6 100644
--- a/optik_ext.py
+++ b/optik_ext.py
@@ -29,7 +29,7 @@ try:
# python >= 2.3
from optparse import OptionParser as BaseParser, Option as BaseOption, \
OptionGroup, OptionValueError, OptionError, Values, HelpFormatter, \
- NO_DEFAULT
+ NO_DEFAULT, SUPPRESS_HELP
except ImportError:
# python < 2.3
from optik import OptionParser as BaseParser, Option as BaseOption, \
@@ -153,6 +153,7 @@ class Option(BaseOption):
"""
TYPES = BaseOption.TYPES + ('regexp', 'csv', 'yn', 'named', 'password',
'multiple_choice', 'file', 'font', 'color')
+ ATTRS = BaseOption.ATTRS + ['hide']
TYPE_CHECKER = copy(BaseOption.TYPE_CHECKER)
TYPE_CHECKER['regexp'] = check_regexp
TYPE_CHECKER['csv'] = check_csv
@@ -166,6 +167,11 @@ class Option(BaseOption):
TYPES += ('date',)
TYPE_CHECKER['date'] = check_date
+ def __init__(self, *opts, **attrs):
+ BaseOption.__init__(self, *opts, **attrs)
+ if hasattr(self, "hide") and self.hide:
+ self.help = SUPPRESS_HELP
+
def _check_choice(self):
"""FIXME: need to override this due to optik misdesign"""
if self.type in ("choice", "multiple_choice"):