diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-04-09 02:30:48 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-04-09 11:53:00 +0200 |
commit | ececb7326200d6c59fa15f7542421099d3899297 (patch) | |
tree | e83b5c50a1c6ed900d6b6e7074c0940f8f0b6ea9 /source4/scripting/python | |
parent | 9af8d02b2230f78e4842106b918ff278dadd1d59 (diff) | |
download | samba-ececb7326200d6c59fa15f7542421099d3899297.tar.gz samba-ececb7326200d6c59fa15f7542421099d3899297.tar.bz2 samba-ececb7326200d6c59fa15f7542421099d3899297.zip |
Support --version in python scripts.
Diffstat (limited to 'source4/scripting/python')
-rw-r--r-- | source4/scripting/python/samba/getopt.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/getopt.py b/source4/scripting/python/samba/getopt.py index 1fbfd9c713..6ec7defde8 100644 --- a/source4/scripting/python/samba/getopt.py +++ b/source4/scripting/python/samba/getopt.py @@ -71,6 +71,14 @@ class VersionOptions(optparse.OptionGroup): """Command line option for printing Samba version.""" def __init__(self, parser): optparse.OptionGroup.__init__(self, parser, "Version Options") + self.add_option("--version", action="callback", + callback=self._display_version, + help="Display version number") + + def _display_version(self, option, opt_str, arg, parser): + import samba, sys + print samba.version + sys.exit(0) class CredentialsOptions(optparse.OptionGroup): |