added cheap status handler, printing to console
This commit is contained in:
1 parent
8dac698ca2
commit
b8d96c8b5a
2 files changed
+40
-2
No files matched your search
@@ -3,6 +3,7 @@
|
||||
import os
|
||||
import sys
|
||||
import getopt
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from CmdWindow import CmdWindow
|
||||
from Command import Command
|
||||
@@ -105,10 +106,26 @@ def processTask(cmd, store):
|
||||
store.createTask(nameparts[-1].strip(), longname, None)
|
||||
return False
|
||||
|
||||
def processStatus(cmd, store):
|
||||
now = datetime.now()
|
||||
monday = now - timedelta(now.weekday())
|
||||
sunday = monday + timedelta(6)
|
||||
entries = store.getEntriesInDateRange(monday, sunday)
|
||||
prevtask = 0
|
||||
for ent in entries:
|
||||
if ent.taskid != prevtask:
|
||||
prevtask = ent.taskid
|
||||
task = store.getTaskByID(ent.taskid)
|
||||
print store.getTaskPath(task) + ':'
|
||||
hours = round(float(ent.seconds) / (60 * 60), 1)
|
||||
print ' %s: %0.1f' % (ent.date, hours)
|
||||
return False
|
||||
|
||||
COMMAND_HANDLERS = {
|
||||
'start' : processStart,
|
||||
'out' : processOut,
|
||||
'task' : processTask
|
||||
'task' : processTask,
|
||||
'status' : processStatus
|
||||
}
|
||||
|
||||
# Returns boolean for whether the command prompt should be displayed again
|
||||
|
||||
Reference in new issue
Block a user