summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGui Chen <gui.chen@intel.com>2012-08-02 15:06:56 +0800
committerGui Chen <gui.chen@intel.com>2012-08-02 15:06:56 +0800
commitcecc9b445a1f6c2058d45a8bfe1ee7d9206c0484 (patch)
tree2c7cea44f4a5211e2fd8d745e6c9c2c3e3b1de05 /tools
parent85f7561bea7198e1e86d156fa53694b9085ba209 (diff)
downloadmic-cecc9b445a1f6c2058d45a8bfe1ee7d9206c0484.tar.gz
mic-cecc9b445a1f6c2058d45a8bfe1ee7d9206c0484.tar.bz2
mic-cecc9b445a1f6c2058d45a8bfe1ee7d9206c0484.zip
better handling for print version
Signed-off-by: Gui Chen <gui.chen@intel.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/mic12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/mic b/tools/mic
index 74294c3..d0c6fed 100755
--- a/tools/mic
+++ b/tools/mic
@@ -37,10 +37,15 @@ class MicCmd(cmdln.Cmdln):
name = 'mic'
version = VERSION
+ def print_version(self):
+ msger.raw("%s %s (%s)" % (self.name,
+ self.version,
+ misc.get_distro_str()))
+
def get_optparser(self):
optparser = cmdln.CmdlnOptionParser(self, version=self.version)
- # don't output version info by optparse, mic shows it
- optparser.version = ""
+ # hook optparse print_version here
+ optparser.print_version = self.print_version
optparser.add_option('-d', '--debug', action='store_true',
dest='debug',
help='print debug message')
@@ -62,6 +67,8 @@ class MicCmd(cmdln.Cmdln):
msger.set_loglevel('debug')
+ self.print_version()
+
def help_create(self):
cr = creator.Creator()
cr.optparser = cr.get_optparser()
@@ -206,7 +213,6 @@ class MicCmd(cmdln.Cmdln):
if __name__ == "__main__":
try:
- msger.raw("mic %s (%s)" % (VERSION, misc.get_distro_str()))
mic = MicCmd()
sys.exit(mic.main())