commit 23622352318df1fe500b70c07f552f1c9970b93c Author: Alex Kelly Date: Tue Aug 17 12:12:01 2021 -0400 initial checkin diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9382d0a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,17 @@ +[tool.poetry] +name = "task-status" +version = "0.1.0" +description = "Utility to get status data built from taskwarrior" +authors = ["Alex Kelly "] + +[tool.poetry.dependencies] +python = "^3.9" + +[tool.poetry.dev-dependencies] + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry.scripts] +task-status = 'task_status.task_status:main' diff --git a/task_status/__init__.py b/task_status/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/task_status/task_status.py b/task_status/task_status.py new file mode 100755 index 0000000..253df1c --- /dev/null +++ b/task_status/task_status.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +import subprocess +import json +from datetime import date +from dateutil.relativedelta import relativedelta, MO + + +def main(): + today = date.today() + last_monday = today + relativedelta(weekday=MO(-2)) + + tasks = subprocess.run( + ["task", "+status", f"end.after:{last_monday}", "export"], capture_output=True + ) + + entries = json.loads(tasks.stdout.decode()) + last_project = "" + for entry in entries: + if entry["project"] != last_project: + last_project = entry["project"] + print(f"* {entry['project']}") + print(f"\t* {entry['description']}") + + +if __name__ == "__main__": + main()