due/hw: Make add() take a tag for the due/t tag
This commit is contained in:
parent
2105f48ebb
commit
556212827a
5
due.py
5
due.py
@ -46,11 +46,12 @@ class todo_item:
|
||||
|
||||
return fancy_text
|
||||
|
||||
def add(date_input, desc):
|
||||
def add(tag, date_input, desc):
|
||||
print(tag, 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])
|
||||
subprocess.call(["todo.sh", "add", desc, tag + ":" + date])
|
||||
|
||||
def due(search_term="", relative=False):
|
||||
command = ["todo.sh", "list"]
|
||||
|
6
hw
6
hw
@ -5,6 +5,7 @@ import sys
|
||||
import due
|
||||
|
||||
PRIORITY = "(B)"
|
||||
TAG = "due"
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("Not enough args!")
|
||||
@ -32,10 +33,9 @@ elif sys.argv[2] == "add":
|
||||
c = input("Class")
|
||||
date = input("Date")
|
||||
desc = input("Assignment")
|
||||
due.add(date, "{} +hw class:{} {}".format(PRIORITY, c, desc))
|
||||
due.add(TAG, date, "{} +hw class:{} {}".format(PRIORITY, c, desc))
|
||||
elif len(sys.argv) >= 6:
|
||||
print(sys.argv[3:])
|
||||
due.add(sys.argv[3],
|
||||
due.add(TAG, sys.argv[3],
|
||||
"{} +hw class:{} {}".format(PRIORITY,
|
||||
sys.argv[4],
|
||||
" ".join(sys.argv[5:])))
|
||||
|
Loading…
Reference in New Issue
Block a user