due: Add 'add' method
This commit is contained in:
parent
9b1367e2f8
commit
c36a301d08
7
due
7
due
@ -5,6 +5,7 @@ import re
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import parsedatetime
|
||||||
|
|
||||||
TAGS = ['t', 'due']
|
TAGS = ['t', 'due']
|
||||||
|
|
||||||
@ -46,6 +47,12 @@ class todo_item:
|
|||||||
|
|
||||||
return fancy_text
|
return fancy_text
|
||||||
|
|
||||||
|
def add(date_input, desc):
|
||||||
|
cal = parsedatetime.Calendar()
|
||||||
|
time_struct, parse_status = cal.parse(date_input)
|
||||||
|
date = datetime(*time_struct[:6]).strftime("%Y-%m-%d")
|
||||||
|
subprocess.call(["todo.sh", "add", desc, "t:" + date])
|
||||||
|
|
||||||
def due(search_term="", relative=False):
|
def due(search_term="", relative=False):
|
||||||
command = ["todo.sh", "list"]
|
command = ["todo.sh", "list"]
|
||||||
command.append(search_term)
|
command.append(search_term)
|
||||||
|
Loading…
Reference in New Issue
Block a user