From ececb7326200d6c59fa15f7542421099d3899297 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 9 Apr 2010 02:30:48 +0200 Subject: Support --version in python scripts. --- source4/scripting/python/samba/getopt.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source4') 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): -- cgit