summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/python/samba/getopt.py8
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):