def main(): from optparse import OptionParser; importFilename = "test.taskpaper" tpBlob = None debugprint('main function of taskRemover') taskToRemoveText = None; #Parse for cmd line values optParser = OptionParser() optParser.add_option("-i","--inputFilename",dest='filename',help="input file",type='string') optParser.add_option("-r","--removeTask",dest='taskName',help="Task name to remove ",type='string') debugprint('parsing') (option, arg) = optParser.parse_args(); if(option.filename and option.filename != ""): importFilename = option.filename; debugprint('import filename') if(option.taskName and option.taskName != ""): taskToRemoveText = option.taskName if(importFilename): tpBlob = TaskFile(importFilename) if tpBlob and taskToRemoveText: tpBlob.autobackup() taskMatches = tpBlob.findTaskByMatching(taskToRemoveText) if(len(taskMatches) == 0): print "No matches" elif(len(taskMatches) == 1): print 'Removing task %s' %taskMatches[0] tpBlob.removeExactMatch(taskMatches[0]) # tpBlob.save() # if(gDebug == False): # tpBlog.deleteAutobackup() elif(len(taskMatches) > 1): print "Too many matches %d" % len(taskMatches) print "==== Matched Tasks ====\n" for task in taskMatches: print task #sets ISO dates based on the passed day dueTasks = tpBlob.setIsoDates()
def main(): from optparse import OptionParser; importFilename = "test.taskpaper" tpBlob = None taskTextToFind = None debugprint('main function of taskDone') #Parse for cmd line values optParser = OptionParser() optParser.add_option('-i','--inputFilename',dest='filename',help='input file',type='string') optParser.add_option('-t','--taskText',dest ='taskText', help='text_to_match',type='string') debugprint('parsing') (option, arg) = optParser.parse_args(); if(option.filename and option.filename != ""): importFilename = option.filename; debugprint('import filename') if(option.taskText and option.taskText != ""): taskTextToFind = option.taskText #do something based on the settings if(importFilename): tpBlob = TaskFile(importFilename) if tpBlob and (taskTextToFind is not None): debugprint('trying to match') matchedArray = tpBlob.findTaskByMatching(taskTextToFind) print ("== Found %02d Matches ==" % len(matchedArray)) # dueItems = tpBlob.findDue(targetDatetime) # if(exportDueType == "stdout"): # print "Due Items:" else: print "No task to check-off has been specified"