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
|
return fancy_text
|
||||||
|
|
||||||
def add(date_input, desc):
|
def add(tag, date_input, desc):
|
||||||
|
print(tag, date_input, desc)
|
||||||
cal = parsedatetime.Calendar()
|
cal = parsedatetime.Calendar()
|
||||||
time_struct, parse_status = cal.parse(date_input)
|
time_struct, parse_status = cal.parse(date_input)
|
||||||
date = datetime(*time_struct[:6]).strftime("%Y-%m-%d")
|
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):
|
def due(search_term="", relative=False):
|
||||||
command = ["todo.sh", "list"]
|
command = ["todo.sh", "list"]
|
||||||
|
6
hw
6
hw
@ -5,6 +5,7 @@ import sys
|
|||||||
import due
|
import due
|
||||||
|
|
||||||
PRIORITY = "(B)"
|
PRIORITY = "(B)"
|
||||||
|
TAG = "due"
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("Not enough args!")
|
print("Not enough args!")
|
||||||
@ -32,10 +33,9 @@ elif sys.argv[2] == "add":
|
|||||||
c = input("Class")
|
c = input("Class")
|
||||||
date = input("Date")
|
date = input("Date")
|
||||||
desc = input("Assignment")
|
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:
|
elif len(sys.argv) >= 6:
|
||||||
print(sys.argv[3:])
|
due.add(TAG, sys.argv[3],
|
||||||
due.add(sys.argv[3],
|
|
||||||
"{} +hw class:{} {}".format(PRIORITY,
|
"{} +hw class:{} {}".format(PRIORITY,
|
||||||
sys.argv[4],
|
sys.argv[4],
|
||||||
" ".join(sys.argv[5:])))
|
" ".join(sys.argv[5:])))
|
||||||
|
Loading…
Reference in New Issue
Block a user