feat: added --header option to display start date of report

This commit is contained in:
Alex Kelly 2021-08-19 15:20:21 -04:00
parent f9de988005
commit 028fda815b

View file

@ -11,7 +11,8 @@ __version__ = "0.1.1"
@click.command()
@click.version_option(__version__, prog_name="task-status")
@click.option("--uuid", is_flag=True, help="Display the task UUID")
def main(uuid):
@click.option("--header", is_flag=True, help="Display date header")
def main(uuid, header):
today = date.today()
last_monday = today + relativedelta(weekday=MO(-2))
@ -28,6 +29,8 @@ def main(uuid):
entries = json.loads(tasks.stdout.decode())
last_project = ""
if header:
print(f"Reporting from: {last_monday}")
for entry in entries:
if entry["project"] != last_project:
last_project = entry["project"]