From fbbd22d3c9cd1ee9b6a1324bbdaf9ce4f330721a Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 9 Aug 2010 11:29:24 -0400 Subject: [PATCH] Add --version option to hooke.hooke.main --- hooke/hooke.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hooke/hooke.py b/hooke/hooke.py index c2ef159..52834df 100644 --- a/hooke/hooke.py +++ b/hooke/hooke.py @@ -64,12 +64,13 @@ import unittest import StringIO import sys -from . import engine as engine +from . import version +from . import engine from . import config as config_mod -from . import playlist as playlist +from . import playlist from . import plugin as plugin_mod from . import driver as driver_mod -from . import ui as ui +from . import ui class Hooke (object): @@ -171,6 +172,9 @@ class HookeRunner (object): def main(): p = optparse.OptionParser() + p.add_option( + '--version', dest='version', default=False, action='store_true', + help="Print Hooke's version information and exit.") p.add_option( '-s', '--script', dest='script', metavar='FILE', help='Script of command line Hooke commands to run.') @@ -188,6 +192,9 @@ def main(): hooke = Hooke(debug=__debug__) runner = HookeRunner() + if options.version == True: + print version() + sys.exit(0) if options.script != None: f = open(os.path.expanduser(options.script), 'r') options.commands.extend(f.readlines()) -- 2.26.2