remove -c option, made its behavior the default, fix DataStore bug

This commit is contained in:
Josh Holtrop committed 2010-12-28 19:02:28 -05:00
1 parent ec4383c993
commit be2789de8d
2 files changed
+11 -8

No files matched your search

+10 -7
View File
@@ -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] <dbfile>
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()