diff options
author | Gui Chen <gui.chen@intel.com> | 2012-08-02 15:06:56 +0800 |
---|---|---|
committer | Gui Chen <gui.chen@intel.com> | 2012-08-02 15:06:56 +0800 |
commit | cecc9b445a1f6c2058d45a8bfe1ee7d9206c0484 (patch) | |
tree | 2c7cea44f4a5211e2fd8d745e6c9c2c3e3b1de05 /tools | |
parent | 85f7561bea7198e1e86d156fa53694b9085ba209 (diff) | |
download | mic-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-x | tools/mic | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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()) |