feat: Added click and --uuid to display task's uuid to aid in cleanup of tasks
This commit is contained in:
parent
c6ae58aa28
commit
a7323832c3
4 changed files with 54 additions and 3 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
@ -0,0 +1 @@
|
|||
#layout poetry
|
33
poetry.lock
generated
Normal file
33
poetry.lock
generated
Normal file
|
@ -0,0 +1,33 @@
|
|||
[[package]]
|
||||
name = "click"
|
||||
version = "8.0.1"
|
||||
description = "Composable command line interface toolkit"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.dependencies]
|
||||
colorama = {version = "*", markers = "platform_system == \"Windows\""}
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
version = "0.4.4"
|
||||
description = "Cross-platform colored terminal text."
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.9"
|
||||
content-hash = "cf5e7dbfa6ca82b93668acf8b5da957c296e8b71d7a96e35f81283d97230f610"
|
||||
|
||||
[metadata.files]
|
||||
click = [
|
||||
{file = "click-8.0.1-py3-none-any.whl", hash = "sha256:fba402a4a47334742d782209a7c79bc448911afe1149d07bdabdf480b3e2f4b6"},
|
||||
{file = "click-8.0.1.tar.gz", hash = "sha256:8c04c11192119b1ef78ea049e0a6f0463e4c48ef00a30160c704337586f3ad7a"},
|
||||
]
|
||||
colorama = [
|
||||
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
|
||||
{file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"},
|
||||
]
|
|
@ -6,6 +6,7 @@ authors = ["Alex Kelly <alex.kelly@franklin.edu>"]
|
|||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.9"
|
||||
click = "^8.0.1"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
|
|
|
@ -3,14 +3,27 @@ import subprocess
|
|||
import json
|
||||
from datetime import date
|
||||
from dateutil.relativedelta import relativedelta, MO
|
||||
import click
|
||||
|
||||
__version__ = "0.1.0"
|
||||
|
||||
|
||||
def main():
|
||||
@click.command()
|
||||
@click.version_option(__version__, prog_name="task-status")
|
||||
@click.option("--uuid", is_flag=True, help="Display the task UUID")
|
||||
def main(uuid):
|
||||
today = date.today()
|
||||
last_monday = today + relativedelta(weekday=MO(-2))
|
||||
|
||||
tasks = subprocess.run(
|
||||
["task", "+status", f"end.after:{last_monday}", "export"], capture_output=True
|
||||
[
|
||||
"task",
|
||||
f"end.after:{last_monday}",
|
||||
"export",
|
||||
"-home",
|
||||
"status_report:display",
|
||||
],
|
||||
capture_output=True,
|
||||
)
|
||||
|
||||
entries = json.loads(tasks.stdout.decode())
|
||||
|
@ -19,7 +32,10 @@ def main():
|
|||
if entry["project"] != last_project:
|
||||
last_project = entry["project"]
|
||||
print(f"* {entry['project']}")
|
||||
print(f"\t* {entry['description']}")
|
||||
if uuid:
|
||||
print(f"\t* {entry['description']} ({entry['uuid']})")
|
||||
else:
|
||||
print(f"\t* {entry['description']}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in a new issue