Command constructor: default_time optional
This commit is contained in:
parent
67a04df59a
commit
78cb101357
@ -3,8 +3,11 @@ from datetime import datetime, timedelta
|
||||
import re
|
||||
|
||||
class Command:
|
||||
def __init__(self, default_time, cmdline):
|
||||
self.time = default_time
|
||||
def __init__(self, cmdline, default_time = None):
|
||||
if default_time is None:
|
||||
self.time = datetime.now()
|
||||
else:
|
||||
self.time = default_time
|
||||
self.command = 'start'
|
||||
self.argstr = ''
|
||||
self.parseCommandLine(cmdline)
|
||||
|
5
dwtt
5
dwtt
@ -3,7 +3,6 @@
|
||||
import os
|
||||
import sys
|
||||
import getopt
|
||||
from datetime import datetime
|
||||
|
||||
from CmdWindow import CmdWindow
|
||||
from Command import Command
|
||||
@ -24,8 +23,6 @@ def main(argv):
|
||||
usage()
|
||||
sys.exit(1)
|
||||
|
||||
timenow = datetime.now()
|
||||
|
||||
for opt, arg in opts:
|
||||
if opt == "--help":
|
||||
usage()
|
||||
@ -41,7 +38,7 @@ def main(argv):
|
||||
ds = DataStore(timedbfile)
|
||||
|
||||
cmdline = doCmdWindow()
|
||||
cmd = Command(timenow, cmdline)
|
||||
cmd = Command(cmdline)
|
||||
print "Command:", cmd
|
||||
|
||||
def doCmdWindow():
|
||||
|
Loading…
x
Reference in New Issue
Block a user