enable list.filtered

This commit is contained in:
Johann Dreo 2023-08-21 19:19:03 +02:00
commit a752bb44b6
5 changed files with 46 additions and 4 deletions

View file

@ -67,3 +67,7 @@
{"description":"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?","entry":"20230821T064218Z","modified":"20230821T064416Z","priority":"H","status":"pending","uuid":"b2233e70-b1fd-41db-b240-0fc265e3406e","tags":["feat"]}
{"description":"theme config: use taskwarrior theme config and extends from there.","entry":"20230819T190428Z","modified":"20230821T064435Z","priority":"H","status":"pending","uuid":"6b248843-1b11-487b-85e8-a96e668f6772","tags":["feat","themes"]}
{"description":"more themes","entry":"20230812T182344Z","modified":"20230821T064530Z","status":"pending","uuid":"9ee183d4-3413-4efa-ba68-10d709669c05","tags":["themes"]}
{"description":"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?","entry":"20230821T064218Z","modified":"20230821T171338Z","priority":"H","start":"20230821T171338Z","status":"pending","uuid":"b2233e70-b1fd-41db-b240-0fc265e3406e","tags":["feat"]}
{"description":"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?","entry":"20230821T064218Z","modified":"20230821T171624Z","priority":"H","status":"pending","uuid":"b2233e70-b1fd-41db-b240-0fc265e3406e","tags":["feat"]}
{"description":"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?","entry":"20230821T064218Z","modified":"20230821T171646Z","priority":"H","start":"20230821T171646Z","status":"pending","uuid":"b2233e70-b1fd-41db-b240-0fc265e3406e","tags":["feat"]}
{"description":"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?","end":"20230821T171844Z","entry":"20230821T064218Z","modified":"20230821T171844Z","priority":"H","status":"completed","uuid":"b2233e70-b1fd-41db-b240-0fc265e3406e","tags":["feat"]}

View file

@ -1,3 +1,4 @@
[description:"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?" end:"1692638324" entry:"1692600138" modified:"1692638324" priority:"H" status:"completed" tags:"feat" tags_feat:"x" uuid:"b2233e70-b1fd-41db-b240-0fc265e3406e"]
[description:"init command: add a command to initialize a local .task dir and\/or config file.s" end:"1692600151" entry:"1692121630" modified:"1692600151" priority:"M" status:"completed" tags:"feat" tags_feat:"x" uuid:"81fc6480-e8e7-4dd4-9f01-a00f34463135"]
[description:"find data updir: try to find .task on upper directories if not in the existing one" end:"1692598477" entry:"1691773581" modified:"1692598477" priority:"H" status:"completed" tags:"data,feat" tags_data:"x" tags_feat:"x" uuid:"b4ee0b55-0bb3-4a2f-b7c5-87cd70dd0ff0"]
[description:"screenshots: to be added to the README on Github." end:"1692546052" entry:"1692538594" modified:"1692546052" status:"completed" tags:"website" tags_website:"x" uuid:"b5f1d2b6-9e2f-458f-afab-880c52121c82"]

View file

@ -6,4 +6,3 @@
[description:"handle prompts: for some commands like delete, taskwarrior setup an interactive prompt, which needs to be handled." entry:"1692122614" modified:"1692122614" status:"pending" tags:"bug" tags_bug:"x" uuid:"e2480c4b-4c73-4d03-8568-82f14ade7b38"]
[description:"semantic colors: allow coloring by values, not just fields." entry:"1692255328" modified:"1692255328" status:"pending" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"1a5aab4a-0c2b-444f-9259-6eddc29b9791"]
[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"]
[description:"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?" entry:"1692600138" modified:"1692600256" priority:"H" status:"pending" tags:"feat" tags_feat:"x" uuid:"b2233e70-b1fd-41db-b240-0fc265e3406e"]

View file

@ -248,3 +248,19 @@ time 1692600330
old [description:"more themes" entry:"1691864624" modified:"1691990020" start:"1691990020" status:"pending" tags:"themes" tags_themes:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
new [description:"more themes" entry:"1691864624" modified:"1692600330" status:"pending" tags:"themes" tags_themes:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"]
---
time 1692638018
old [description:"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?" entry:"1692600138" modified:"1692600256" priority:"H" status:"pending" tags:"feat" tags_feat:"x" uuid:"b2233e70-b1fd-41db-b240-0fc265e3406e"]
new [description:"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?" entry:"1692600138" modified:"1692638018" priority:"H" start:"1692638018" status:"pending" tags:"feat" tags_feat:"x" uuid:"b2233e70-b1fd-41db-b240-0fc265e3406e"]
---
time 1692638184
old [description:"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?" entry:"1692600138" modified:"1692638018" priority:"H" start:"1692638018" status:"pending" tags:"feat" tags_feat:"x" uuid:"b2233e70-b1fd-41db-b240-0fc265e3406e"]
new [description:"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?" entry:"1692600138" modified:"1692638184" priority:"H" status:"pending" tags:"feat" tags_feat:"x" uuid:"b2233e70-b1fd-41db-b240-0fc265e3406e"]
---
time 1692638206
old [description:"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?" entry:"1692600138" modified:"1692638184" priority:"H" status:"pending" tags:"feat" tags_feat:"x" uuid:"b2233e70-b1fd-41db-b240-0fc265e3406e"]
new [description:"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?" entry:"1692600138" modified:"1692638206" priority:"H" start:"1692638206" status:"pending" tags:"feat" tags_feat:"x" uuid:"b2233e70-b1fd-41db-b240-0fc265e3406e"]
---
time 1692638324
old [description:"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?" entry:"1692600138" modified:"1692638206" priority:"H" start:"1692638206" status:"pending" tags:"feat" tags_feat:"x" uuid:"b2233e70-b1fd-41db-b240-0fc265e3406e"]
new [description:"allow filters: when invoked with filtered command, execute, then display filtered export — or point to altered tasks?" end:"1692638324" entry:"1692600138" modified:"1692638324" priority:"H" status:"completed" tags:"feat" tags_feat:"x" uuid:"b2233e70-b1fd-41db-b240-0fc265e3406e"]
---

View file

@ -420,8 +420,10 @@ def call_taskwarrior(args:list[str] = ['export'], taskfile = ".task") -> str:
return out.decode('utf-8')
def get_data(taskfile):
out = call_taskwarrior(['export'], taskfile)
def get_data(taskfile, filter = None):
if not filter:
filter = []
out = call_taskwarrior(filter+['export'], taskfile)
try:
jdata = json.loads(out)
except json.decoder.JSONDecodeError as exc:
@ -665,6 +667,21 @@ def find_tasks(fname, current, config):
return None
def parse_filter(cmd):
tw_commands = [
"active", "all", "annotate", "append", "blocked", "blocking", "burndown", "burndown", "burndown", "completed",
"count", "delete", "denotate", "done", "duplicate", "edit", "export", "ghistory", "ghistory", "ghistory", "ghistory",
"history", "history", "history", "history", "ids", "information", "list", "long", "ls", "minimal",
"modify", "newest", "next", "oldest", "overdue", "prepend", "projects", "purge", "ready", "recurring", "start",
"stats", "stop", "summary", "tags", "timesheet", "unblocked", "uuids", "waiting",
]
for i,w in enumerate(cmd):
if w in tw_commands:
filter = cmd[:i]
return filter
return None
if __name__ == "__main__":
default_conf = {
@ -683,6 +700,7 @@ if __name__ == "__main__":
"design.swatch": "none",
"design.icons": "none",
"widget.card.wrap": "25",
"list.filtered": "false",
}
# First, taskwarrior's config...
@ -715,7 +733,11 @@ if __name__ == "__main__":
touched = parse_touched(out)
# Then call again to get the resulting data.
jdata = get_data(taskfile)
if as_bool(config["list.filtered"]):
filter = parse_filter(cmd)
jdata = get_data(taskfile, filter)
else:
jdata = get_data(taskfile, filter = None)
# print(json.dumps(jdata, indent=4))
list_separator = ","