44 lines
1.2 KiB
Python
Executable File
44 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
|
|
import due
|
|
|
|
PRIORITY = "(B)"
|
|
TAG = "due"
|
|
|
|
if len(sys.argv) < 2:
|
|
print("Not enough args!")
|
|
exit(0)
|
|
|
|
if sys.argv[1] == "usage":
|
|
print(" hw\n"
|
|
" list homework\n"
|
|
" hw rel\n"
|
|
" list assignments with the dates in days relative to today\n"
|
|
" hw due [date]\n"
|
|
" list assignments due on [date]\n"
|
|
" hw add\n"
|
|
" prompt for adding an assignment\n"
|
|
" hw add [due date] [class] [description]\n"
|
|
" add an assignment without a prompt\n")
|
|
exit(0)
|
|
|
|
if len(sys.argv) < 3 or sys.argv[2] == "due": #default case
|
|
due.due("+hw")
|
|
elif sys.argv[2] == "rel":
|
|
due.due("+hw", True)
|
|
elif sys.argv[2] == "add":
|
|
if len(sys.argv) == 3: #prompt
|
|
c = input("Class")
|
|
date = input("Date")
|
|
desc = input("Assignment")
|
|
due.add(TAG, date, "{} +hw class:{} {}".format(PRIORITY, c, desc))
|
|
elif len(sys.argv) >= 6:
|
|
due.add(TAG, sys.argv[3],
|
|
"{} +hw class:{} {}".format(PRIORITY,
|
|
sys.argv[4],
|
|
" ".join(sys.argv[5:])))
|
|
else:
|
|
print("Invalid args")
|