feat/fix: point out tasks matching a non-editing filtered command

This commit is contained in:
Johann Dreo 2023-08-31 11:14:47 +02:00
commit 71a6841d22
7 changed files with 56 additions and 1 deletions

View file

@ -86,3 +86,11 @@
{"description":"hashed color: add a hash[color1,rgb123,...] color tag allowing to randomly pick a stable color for items like tags","entry":"20230829T153832Z","modified":"20230829T153844Z","priority":"M","status":"pending","uuid":"22082221-a02a-4f85-901e-135a99c396c3","tags":["feat"]}
{"description":"systematic icons: add a systematic way to insert icons after\/before any field","entry":"20230829T153938Z","modified":"20230829T153938Z","status":"pending","uuid":"be1a6eb3-3406-44d1-957a-e952c0d69f2a","tags":["feat","themes"]}
{"description":"theme config: use taskwarrior theme config and extends from there.","end":"20230829T154948Z","entry":"20230819T190428Z","modified":"20230829T154948Z","priority":"H","status":"completed","uuid":"6b248843-1b11-487b-85e8-a96e668f6772","tags":["feat","themes"]}
{"description":"date pretty print: pretty print date fields","entry":"20230830T113831Z","modified":"20230830T113831Z","priority":"L","status":"pending","uuid":"85c7d0dc-4651-4f23-a2ec-9db62937cffd","tags":["feat"]}
{"description":"up\/down dirs: display summary of databases further up or down the current one. p:H","entry":"20230830T193029Z","modified":"20230830T193029Z","status":"pending","uuid":"fc270e5d-23fd-4824-ad9d-061d624272d9","tags":["feat"]}
{"description":"up\/down dirs: display summary of databases further up or down the current one.","entry":"20230830T193035Z","modified":"20230830T193035Z","priority":"H","status":"pending","uuid":"03998ee8-9917-49cf-a6cb-3fdd14a7deb3","tags":["feat"]}
{"description":"up\/down dirs: display summary of databases further up or down the current one.","entry":"20230830T193044Z","modified":"20230830T193044Z","status":"pending","uuid":"1372c26f-b4e3-45b5-80ca-6d052af8f28e","tags":["feat"]}
{"description":"up down dirs: display summary of databases further up or down the current one.","entry":"20230830T193054Z","modified":"20230830T193054Z","status":"pending","uuid":"16684e35-9eb4-452d-aa68-84ef57309e00","tags":["feat"]}
{"description":"touch filtered: point out tasks matching a non-editing filtered command","entry":"20230831T090935Z","modified":"20230831T090935Z","status":"pending","uuid":"c5835e89-fd7d-45bf-82ed-b38cd0d56b43","tags":["feat"]}
{"description":"touch filtered: point out tasks matching a non-editing filtered command","entry":"20230831T090935Z","modified":"20230831T090942Z","start":"20230831T090942Z","status":"pending","uuid":"c5835e89-fd7d-45bf-82ed-b38cd0d56b43","tags":["feat"]}
{"description":"touch filtered: point out tasks matching a non-editing filtered command","end":"20230831T091433Z","entry":"20230831T090935Z","modified":"20230831T091433Z","status":"completed","uuid":"c5835e89-fd7d-45bf-82ed-b38cd0d56b43","tags":["feat"]}

View file

@ -1,3 +1,4 @@
[description:"touch filtered: point out tasks matching a non-editing filtered command" end:"1693473273" entry:"1693472975" modified:"1693473273" status:"completed" tags:"feat" tags_feat:"x" uuid:"c5835e89-fd7d-45bf-82ed-b38cd0d56b43"]
[description:"theme config: use taskwarrior theme config and extends from there." end:"1693324188" entry:"1692471868" modified:"1693324188" priority:"H" status:"completed" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"6b248843-1b11-487b-85e8-a96e668f6772"]
[description:"hide grouped fields: when &open;sub&close;grouping, hide the grouped field from the task display" end:"1693323123" entry:"1693322866" modified:"1693323123" priority:"M" status:"completed" tags:"feat" tags_feat:"x" uuid:"ec74a19f-8ab3-4911-b8d8-3b79a593a5d3"]
[description:"hide old done tasks: Hide tasks with last status that haven t been touched since a long time." end:"1692954719" entry:"1691773751" modified:"1692954719" priority:"M" status:"completed" tags:"feat,wontfix" tags_feat:"x" tags_wontfix:"x" uuid:"e18707b4-304d-41f3-8504-89476cd796f5"]

View file

@ -5,3 +5,8 @@
[description:"semantic colors: allow coloring by values, not just fields." entry:"1692255328" modified:"1692953258" start:"1692953258" status:"pending" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"1a5aab4a-0c2b-444f-9259-6eddc29b9791"]
[description:"hashed color: add a hash&open;color1,rgb123,...&close; color tag allowing to randomly pick a stable color for items like tags" entry:"1693323512" modified:"1693323524" priority:"M" status:"pending" tags:"feat" tags_feat:"x" uuid:"22082221-a02a-4f85-901e-135a99c396c3"]
[description:"systematic icons: add a systematic way to insert icons after\/before any field" entry:"1693323578" modified:"1693323578" status:"pending" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"be1a6eb3-3406-44d1-957a-e952c0d69f2a"]
[description:"date pretty print: pretty print date fields" entry:"1693395511" modified:"1693395511" priority:"L" status:"pending" tags:"feat" tags_feat:"x" uuid:"85c7d0dc-4651-4f23-a2ec-9db62937cffd"]
[description:"up\/down dirs: display summary of databases further up or down the current one. p:H" entry:"1693423829" modified:"1693423829" status:"pending" tags:"feat" tags_feat:"x" uuid:"fc270e5d-23fd-4824-ad9d-061d624272d9"]
[description:"up\/down dirs: display summary of databases further up or down the current one." entry:"1693423835" modified:"1693423835" priority:"H" status:"pending" tags:"feat" tags_feat:"x" uuid:"03998ee8-9917-49cf-a6cb-3fdd14a7deb3"]
[description:"up\/down dirs: display summary of databases further up or down the current one." entry:"1693423844" modified:"1693423844" status:"pending" tags:"feat" tags_feat:"x" uuid:"1372c26f-b4e3-45b5-80ca-6d052af8f28e"]
[description:"up down dirs: display summary of databases further up or down the current one." entry:"1693423854" modified:"1693423854" status:"pending" tags:"feat" tags_feat:"x" uuid:"16684e35-9eb4-452d-aa68-84ef57309e00"]

View file

@ -321,3 +321,29 @@ time 1693324188
old [description:"theme config: use taskwarrior theme config and extends from there." entry:"1692471868" modified:"1692600275" priority:"H" status:"pending" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"6b248843-1b11-487b-85e8-a96e668f6772"]
new [description:"theme config: use taskwarrior theme config and extends from there." end:"1693324188" entry:"1692471868" modified:"1693324188" priority:"H" status:"completed" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"6b248843-1b11-487b-85e8-a96e668f6772"]
---
time 1693395512
new [description:"date pretty print: pretty print date fields" entry:"1693395511" modified:"1693395511" priority:"L" status:"pending" tags:"feat" tags_feat:"x" uuid:"85c7d0dc-4651-4f23-a2ec-9db62937cffd"]
---
time 1693423829
new [description:"up\/down dirs: display summary of databases further up or down the current one. p:H" entry:"1693423829" modified:"1693423829" status:"pending" tags:"feat" tags_feat:"x" uuid:"fc270e5d-23fd-4824-ad9d-061d624272d9"]
---
time 1693423835
new [description:"up\/down dirs: display summary of databases further up or down the current one." entry:"1693423835" modified:"1693423835" priority:"H" status:"pending" tags:"feat" tags_feat:"x" uuid:"03998ee8-9917-49cf-a6cb-3fdd14a7deb3"]
---
time 1693423844
new [description:"up\/down dirs: display summary of databases further up or down the current one." entry:"1693423844" modified:"1693423844" status:"pending" tags:"feat" tags_feat:"x" uuid:"1372c26f-b4e3-45b5-80ca-6d052af8f28e"]
---
time 1693423854
new [description:"up down dirs: display summary of databases further up or down the current one." entry:"1693423854" modified:"1693423854" status:"pending" tags:"feat" tags_feat:"x" uuid:"16684e35-9eb4-452d-aa68-84ef57309e00"]
---
time 1693472975
new [description:"touch filtered: point out tasks matching a non-editing filtered command" entry:"1693472975" modified:"1693472975" status:"pending" tags:"feat" tags_feat:"x" uuid:"c5835e89-fd7d-45bf-82ed-b38cd0d56b43"]
---
time 1693472982
old [description:"touch filtered: point out tasks matching a non-editing filtered command" entry:"1693472975" modified:"1693472975" status:"pending" tags:"feat" tags_feat:"x" uuid:"c5835e89-fd7d-45bf-82ed-b38cd0d56b43"]
new [description:"touch filtered: point out tasks matching a non-editing filtered command" entry:"1693472975" modified:"1693472982" start:"1693472982" status:"pending" tags:"feat" tags_feat:"x" uuid:"c5835e89-fd7d-45bf-82ed-b38cd0d56b43"]
---
time 1693473273
old [description:"touch filtered: point out tasks matching a non-editing filtered command" entry:"1693472975" modified:"1693472982" start:"1693472982" status:"pending" tags:"feat" tags_feat:"x" uuid:"c5835e89-fd7d-45bf-82ed-b38cd0d56b43"]
new [description:"touch filtered: point out tasks matching a non-editing filtered command" end:"1693473273" entry:"1693472975" modified:"1693473273" status:"completed" tags:"feat" tags_feat:"x" uuid:"c5835e89-fd7d-45bf-82ed-b38cd0d56b43"]
---

2
.twdrc
View file

@ -1,4 +1,6 @@
list.filtered=no
layout.subsections = Vertical
layout.subsections.group = priority
layout.sections.group.show = H,M,L,

View file

@ -27,3 +27,5 @@ color.priority.=rgbb7b7ff
color.tags.themes=rgb0077ff
color.tags.feat=rgb00aaff
color.tags.bug=rgb00ccff
color.project=rgb8877ff

View file

@ -299,7 +299,8 @@ class stack:
# Description is a special case.
if k == "description" and ":" in val:
# Split description in "short: long".
short, desc = val.split(":")
vals = val.split(":")
short, desc = vals[0], ":".join(vals[1:])
# FIXME groups add a newline or hide what follows, no option to avoid it.
# row.append( rich.console.Group(
# rich.text.Text(short+":", style="color.description.short", end="\n"),
@ -467,6 +468,7 @@ def call_taskwarrior(args:list[str] = ["export"], taskfile = ".task") -> str:
env["TASKDATA"] = taskfile
cmd = ["task"] + args
# print(cmd)
try:
p = subprocess.Popen( " ".join(cmd),
stdout=subprocess.PIPE,
@ -727,6 +729,7 @@ if __name__ == "__main__":
# First pass arguments to taskwarrior and let it do its magic.
out = call_taskwarrior(cmd, taskfile)
touched = []
if "Description" not in out:
print(out.strip())
touched = parse_touched(out)
@ -737,6 +740,14 @@ if __name__ == "__main__":
jdata = get_data(taskfile, filter)
else:
jdata = get_data(taskfile, filter = None)
# If no explicit touch from an editing command,
# then just point out tasks matching the filter.
if not touched:
filter = parse_filter(cmd)
filtered = get_data(taskfile, filter)
if len(filtered) != len(jdata):
touched = [str(t["id"]) for t in filtered]
# print(json.dumps(jdata, indent=4))
list_separator = ","