diff --git a/DataStore.py b/DataStore.py index ee128c7..fd20af1 100644 --- a/DataStore.py +++ b/DataStore.py @@ -6,7 +6,7 @@ class DataStore: def __init__(self, timedbfile): if not os.path.exists(timedbfile): self.createdb(timedbfile) - self.conn = sqlite3.connect(dbfile) + self.conn = sqlite3.connect(timedbfile) def __del__(self): self.conn.close() diff --git a/dwtt b/dwtt index c6a63f0..baf75b0 100755 --- a/dwtt +++ b/dwtt @@ -5,19 +5,19 @@ from Command import Command import sys import getopt from datetime import datetime +from DataStore import DataStore PROGRAM_NAME = 'dwtt' def usage(): print '''Usage: dwtt [options] Options: - -c Open a window to take a command as input --help Show this help ''' def main(argv): try: - opts, args = getopt.getopt(argv[1:], "c", ["help"]) + opts, args = getopt.getopt(argv[1:], "", ["help"]) except getopt.GetoptError: usage() sys.exit(1) @@ -25,13 +25,13 @@ def main(argv): timenow = datetime.now() for opt, arg in opts: - if opt == '-c': - cmdline = doCmdWindow() - print "cmd was:", cmdline - cmd = Command(timenow, cmdline) - elif opt == "--help": + if opt == "--help": usage() sys.exit() + else: + usage() + sys.exit(3) + if len(args) < 1: usage() sys.exit(2) @@ -39,6 +39,9 @@ def main(argv): ds = DataStore(timedbfile) + cmdline = doCmdWindow() + cmd = Command(timenow, cmdline) + def doCmdWindow(): c = CmdWindow() return c.main()