Add --ignore option to skip projects from report. Update deps
This commit is contained in:
parent
727b2857fb
commit
b0457b3f9e
3 changed files with 1509 additions and 972 deletions
2456
poetry.lock
generated
2456
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "task-status"
|
name = "task-status"
|
||||||
version = "0.3.1"
|
version = "0.4.1"
|
||||||
description = "Utility to get status data built from taskwarrior"
|
description = "Utility to get status data built from taskwarrior"
|
||||||
authors = ["Alex Kelly <alex.kelly@franklin.edu>"]
|
authors = ["Alex Kelly <alex.kelly@franklin.edu>"]
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@ python = "^3.9"
|
||||||
click = "^8.0.1"
|
click = "^8.0.1"
|
||||||
python-dateutil = "^2.8.2"
|
python-dateutil = "^2.8.2"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
pytest = "^6.2.4"
|
pytest = "^6.2.4"
|
||||||
flake8 = "^3.9.2"
|
flake8 = "^3.9.2"
|
||||||
python-semantic-release = "^7.19.1"
|
python-semantic-release = "^7.19.1"
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,17 @@ def validate_tasks(tasks):
|
||||||
return tasks
|
return tasks
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@click.version_option(__version__, prog_name="task-status")
|
|
||||||
@click.option("--uuid", is_flag=True, help="Display the task UUID")
|
|
||||||
@click.option("--header", is_flag=True, help="Display date header")
|
|
||||||
@click.option("--bullet", default="*", help="Character to use for bullets in list")
|
@click.option("--bullet", default="*", help="Character to use for bullets in list")
|
||||||
|
@click.option("--header", is_flag=True, help="Display date header")
|
||||||
|
@click.option(
|
||||||
|
"--ignore", multiple=True, help="Project(s) to ignore in the report (can be used multiple times)"
|
||||||
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--sort", is_flag=True, default=True, help="Alphabetically sort by project"
|
"--sort", is_flag=True, default=True, help="Alphabetically sort by project"
|
||||||
)
|
)
|
||||||
def main(uuid, header, bullet, sort):
|
@click.option("--uuid", is_flag=True, help="Display the task UUID")
|
||||||
|
@click.version_option(__version__, prog_name="task-status")
|
||||||
|
def main(uuid, header, bullet, sort, ignore):
|
||||||
"""Main function that does all the work for task_status"""
|
"""Main function that does all the work for task_status"""
|
||||||
today = date.today()
|
today = date.today()
|
||||||
last_monday = today + relativedelta(weekday=MO(-2))
|
last_monday = today + relativedelta(weekday=MO(-2))
|
||||||
|
|
@ -47,6 +50,10 @@ def main(uuid, header, bullet, sort):
|
||||||
check=True,
|
check=True,
|
||||||
)
|
)
|
||||||
entries = validate_tasks(json.loads(tasks.stdout.decode()))
|
entries = validate_tasks(json.loads(tasks.stdout.decode()))
|
||||||
|
|
||||||
|
# Convert ignore tuple to set for faster lookup
|
||||||
|
ignored_projects = set(ignore)
|
||||||
|
|
||||||
output_list = []
|
output_list = []
|
||||||
project_list = []
|
project_list = []
|
||||||
if header:
|
if header:
|
||||||
|
|
@ -54,10 +61,10 @@ def main(uuid, header, bullet, sort):
|
||||||
for status_projects, status_entries in itertools.groupby(
|
for status_projects, status_entries in itertools.groupby(
|
||||||
entries, key=operator.itemgetter("project")
|
entries, key=operator.itemgetter("project")
|
||||||
):
|
):
|
||||||
if status_projects not in project_list:
|
# Skip ignored projects
|
||||||
|
if status_projects not in ignored_projects and status_projects not in project_list:
|
||||||
project_list.append(status_projects)
|
project_list.append(status_projects)
|
||||||
output_list.append(list(status_entries))
|
output_list.append(list(status_entries))
|
||||||
|
|
||||||
if sort:
|
if sort:
|
||||||
project_list.sort()
|
project_list.sort()
|
||||||
for project in project_list:
|
for project in project_list:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue