diff --git a/task_status/task_status.py b/task_status/task_status.py index 334ac1c..37d166b 100755 --- a/task_status/task_status.py +++ b/task_status/task_status.py @@ -10,6 +10,14 @@ import click __version__ = "0.3.0" +def validate_tasks(tasks): + """ Validate tasks have a proejct, inject "None" if they don't """ + try: + for task in tasks: + test = task["project"] + except KeyError: + task["project"] = "None" + return tasks @click.command() @click.version_option(__version__, prog_name="task-status") @@ -30,6 +38,7 @@ def main(uuid, header, bullet, sort): "status_report:display", "-home", "-DELETED", + "-delegated", "export", ] tasks = subprocess.run( @@ -37,8 +46,7 @@ def main(uuid, header, bullet, sort): capture_output=True, check=True, ) - - entries = json.loads(tasks.stdout.decode()) + entries = validate_tasks(json.loads(tasks.stdout.decode())) output_list = [] project_list = [] if header: