summaryrefslogtreecommitdiff
path: root/optparser.py
diff options
context:
space:
mode:
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>2008-01-08 09:37:13 +0100
committerAlexandre Fayolle <alexandre.fayolle@logilab.fr>2008-01-08 09:37:13 +0100
commit11b7f20b1509c2fabc11b26baa95d8bce44e19c6 (patch)
tree797880fbcce1dfc42bdc0b5ad199624071d95e01 /optparser.py
parent3f91a94d6404d472eee1357db65421374bc5dc60 (diff)
downloadlogilab-common-11b7f20b1509c2fabc11b26baa95d8bce44e19c6.tar.gz
added support for --version (closes #4501)
Diffstat (limited to 'optparser.py')
-rw-r--r--optparser.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/optparser.py b/optparser.py
index 0992003..6ae42a9 100644
--- a/optparser.py
+++ b/optparser.py
@@ -64,6 +64,9 @@ class OptionParser(optparse.OptionParser):
if cmd in ('-h', '--help'):
self.print_main_help()
sys.exit(0)
+ elif self.version is not None and cmd == "--version":
+ self.print_version()
+ sys.exit(0)
self.error('unknow command')
self.prog = '%s %s' % (self.prog, cmd)
mod_or_f, help = self._commands[cmd]