diff --git a/.task/backlog.data b/.task/backlog.data index c6c96d2..e2ed135 100644 --- a/.task/backlog.data +++ b/.task/backlog.data @@ -56,3 +56,8 @@ {"description":"screenshots: to be added to the README on Github.","entry":"20230820T133634Z","modified":"20230820T133640Z","start":"20230820T133640Z","status":"pending","uuid":"b5f1d2b6-9e2f-458f-afab-880c52121c82","tags":["website"]} {"description":"screenshots: to be added to the README on Github.","end":"20230820T154052Z","entry":"20230820T133634Z","modified":"20230820T154052Z","status":"completed","uuid":"b5f1d2b6-9e2f-458f-afab-880c52121c82","tags":["website"]} {"description":"find data updir: try to find .task on upper directories if not in the existing one","entry":"20230811T170621Z","modified":"20230820T162832Z","priority":"H","start":"20230820T162832Z","status":"pending","uuid":"b4ee0b55-0bb3-4a2f-b7c5-87cd70dd0ff0","tags":["data","feat"]} +{"description":"find data updir: try to find .task on upper directories if not in the existing one","end":"20230821T061437Z","entry":"20230811T170621Z","modified":"20230821T061437Z","priority":"H","status":"completed","uuid":"b4ee0b55-0bb3-4a2f-b7c5-87cd70dd0ff0","tags":["data","feat"]} +{"description":"init command: add a command to initialize a local .task dir and\/or config file.s","entry":"20230815T174710Z","modified":"20230821T061727Z","priority":"M","start":"20230821T061727Z","status":"pending","uuid":"81fc6480-e8e7-4dd4-9f01-a00f34463135","tags":["feat"]} +{"description":"init command: add a command to initialize a local .task dir and\/or config file.s","entry":"20230815T174710Z","modified":"20230821T061754Z","priority":"M","status":"pending","uuid":"81fc6480-e8e7-4dd4-9f01-a00f34463135","tags":["feat"]} +{"description":"init command: add a command to initialize a local .task dir and\/or config file.s","entry":"20230815T174710Z","modified":"20230821T061804Z","priority":"M","start":"20230821T061804Z","status":"pending","uuid":"81fc6480-e8e7-4dd4-9f01-a00f34463135","tags":["feat"]} +{"description":"init command: add a command to initialize a local .task dir and\/or config file.s","entry":"20230815T174710Z","modified":"20230821T062005Z","priority":"M","status":"pending","uuid":"81fc6480-e8e7-4dd4-9f01-a00f34463135","tags":["feat"]} diff --git a/.task/completed.data b/.task/completed.data index 7e8eb61..0c5704a 100644 --- a/.task/completed.data +++ b/.task/completed.data @@ -1,3 +1,4 @@ +[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"] [description:"config: handle config files from taskwarrior first" end:"1692471959" entry:"1691773951" modified:"1692471959" status:"completed" tags:"feat" tags_feat:"x" uuid:"4d822c4a-d51e-4992-8a22-6e0167ac197a"] [description:"sort by urgency" end:"1692214597" entry:"1691773782" modified:"1692214597" priority:"H" status:"completed" tags:"feat" tags_feat:"x" uuid:"4f041f52-739a-4aca-94e6-164f43e61866"] diff --git a/.task/pending.data b/.task/pending.data index b572f67..bc91add 100644 --- a/.task/pending.data +++ b/.task/pending.data @@ -1,9 +1,8 @@ -[description:"find data updir: try to find .task on upper directories if not in the existing one" entry:"1691773581" modified:"1692548912" priority:"H" start:"1692548912" status:"pending" tags:"data,feat" tags_data:"x" tags_feat:"x" uuid:"b4ee0b55-0bb3-4a2f-b7c5-87cd70dd0ff0"] [description:"semantic tags : allow tags starting with a hash to refer to a github issue or PR" entry:"1691773642" modified:"1692121563" priority:"L" status:"pending" tags:"feat" tags_feat:"x" uuid:"06cf70a9-4f0e-4b32-b7bb-d1799803665c"] [description:"hide old done tasks: Hide tasks with last status that haven t been touched since a long time." entry:"1691773751" modified:"1692122496" priority:"M" status:"pending" tags:"feat" tags_feat:"x" uuid:"e18707b4-304d-41f3-8504-89476cd796f5"] [description:"fix escaped add: when passing add with escapable characters, bug ensues." entry:"1691774077" modified:"1691774077" status:"pending" tags:"bug" tags_bug:"x" uuid:"79e1ba11-15ae-489f-9868-ab6adea40a91"] [description:"more themes" entry:"1691864624" modified:"1691990020" start:"1691990020" status:"pending" tags:"themes" tags_themes:"x" uuid:"9ee183d4-3413-4efa-ba68-10d709669c05"] -[description:"init command: add a command to initialize a local .task dir and\/or config file.s" entry:"1692121630" modified:"1692121630" priority:"M" status:"pending" tags:"feat" tags_feat:"x" uuid:"81fc6480-e8e7-4dd4-9f01-a00f34463135"] +[description:"init command: add a command to initialize a local .task dir and\/or config file.s" entry:"1692121630" modified:"1692598805" priority:"M" status:"pending" tags:"feat" tags_feat:"x" uuid:"81fc6480-e8e7-4dd4-9f01-a00f34463135"] [description:"colored panels: allow selecting a different swatch for each &open;sub&close;panel" entry:"1692122434" modified:"1692122452" priority:"M" status:"pending" tags:"feat,themes" tags_feat:"x" tags_themes:"x" uuid:"ca17838d-958f-498b-bff5-a24576820ae7"] [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"] diff --git a/.task/undo.data b/.task/undo.data index 23c0270..2d70d5d 100644 --- a/.task/undo.data +++ b/.task/undo.data @@ -205,3 +205,23 @@ time 1692548912 old [description:"find data updir: try to find .task on upper directories if not in the existing one" entry:"1691773581" modified:"1692121517" priority:"H" status:"pending" tags:"data,feat" tags_data:"x" tags_feat:"x" uuid:"b4ee0b55-0bb3-4a2f-b7c5-87cd70dd0ff0"] new [description:"find data updir: try to find .task on upper directories if not in the existing one" entry:"1691773581" modified:"1692548912" priority:"H" start:"1692548912" status:"pending" tags:"data,feat" tags_data:"x" tags_feat:"x" uuid:"b4ee0b55-0bb3-4a2f-b7c5-87cd70dd0ff0"] --- +time 1692598477 +old [description:"find data updir: try to find .task on upper directories if not in the existing one" entry:"1691773581" modified:"1692548912" priority:"H" start:"1692548912" status:"pending" tags:"data,feat" tags_data:"x" tags_feat:"x" uuid:"b4ee0b55-0bb3-4a2f-b7c5-87cd70dd0ff0"] +new [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"] +--- +time 1692598647 +old [description:"init command: add a command to initialize a local .task dir and\/or config file.s" entry:"1692121630" modified:"1692121630" priority:"M" status:"pending" tags:"feat" tags_feat:"x" uuid:"81fc6480-e8e7-4dd4-9f01-a00f34463135"] +new [description:"init command: add a command to initialize a local .task dir and\/or config file.s" entry:"1692121630" modified:"1692598647" priority:"M" start:"1692598647" status:"pending" tags:"feat" tags_feat:"x" uuid:"81fc6480-e8e7-4dd4-9f01-a00f34463135"] +--- +time 1692598674 +old [description:"init command: add a command to initialize a local .task dir and\/or config file.s" entry:"1692121630" modified:"1692598647" priority:"M" start:"1692598647" status:"pending" tags:"feat" tags_feat:"x" uuid:"81fc6480-e8e7-4dd4-9f01-a00f34463135"] +new [description:"init command: add a command to initialize a local .task dir and\/or config file.s" entry:"1692121630" modified:"1692598674" priority:"M" status:"pending" tags:"feat" tags_feat:"x" uuid:"81fc6480-e8e7-4dd4-9f01-a00f34463135"] +--- +time 1692598684 +old [description:"init command: add a command to initialize a local .task dir and\/or config file.s" entry:"1692121630" modified:"1692598674" priority:"M" status:"pending" tags:"feat" tags_feat:"x" uuid:"81fc6480-e8e7-4dd4-9f01-a00f34463135"] +new [description:"init command: add a command to initialize a local .task dir and\/or config file.s" entry:"1692121630" modified:"1692598684" priority:"M" start:"1692598684" status:"pending" tags:"feat" tags_feat:"x" uuid:"81fc6480-e8e7-4dd4-9f01-a00f34463135"] +--- +time 1692598805 +old [description:"init command: add a command to initialize a local .task dir and\/or config file.s" entry:"1692121630" modified:"1692598684" priority:"M" start:"1692598684" status:"pending" tags:"feat" tags_feat:"x" uuid:"81fc6480-e8e7-4dd4-9f01-a00f34463135"] +new [description:"init command: add a command to initialize a local .task dir and\/or config file.s" entry:"1692121630" modified:"1692598805" priority:"M" status:"pending" tags:"feat" tags_feat:"x" uuid:"81fc6480-e8e7-4dd4-9f01-a00f34463135"] +--- diff --git a/taskwarrior-deluxe.py b/taskwarrior-deluxe.py index f674864..55140cc 100755 --- a/taskwarrior-deluxe.py +++ b/taskwarrior-deluxe.py @@ -14,6 +14,16 @@ import rich from rich.console import Console from rich.columns import Columns +error_codes = { + "NO_DATA_FILE": 100, +} + + +def error(name,msg): + print("ERROR:",msg) + sys.exit(error_codes[name]) + + class Widget: pass @@ -408,7 +418,7 @@ def get_data(): def parse_touched(out): - return re.findall('[ModifyingCreated]+ task ([0-9]+)', out) + return re.findall('(?:Modifying|Created|Starting|Stopping)+ task ([0-9]+)', out) def get_swatches(name = None): @@ -602,7 +612,7 @@ def upsearch(filename, at = pathlib.Path.cwd()): return None -def load_configs(fname, current): +def find_config(fname, current): config = current # First, system. @@ -632,6 +642,16 @@ def load_configs(fname, current): return config +def find_tasks(fname, current, config): + tfile = upsearch(fname, current) + if tfile: + return tfile + elif "data.location" in config: + return config["data.location"] + else: + return None + + if __name__ == "__main__": default_conf = { @@ -653,14 +673,16 @@ if __name__ == "__main__": } # First, taskwarrior's config... - config = load_configs(".taskrc", default_conf) + config = find_config(".taskrc", default_conf) # ... overwritten by TWD config. - config = load_configs(".twdrc", config) + config = find_config(".twdrc", config) # for k in config: # print(k,"=",config[k]) - list_separator = ',' + taskfile = find_tasks(".task", pathlib.Path.cwd(), config) + if not taskfile: + error("NO_DATA_FILE", "Cannot find a data file here, in a parent directory, or configured.") cmd = sys.argv[1:] @@ -679,6 +701,7 @@ if __name__ == "__main__": jdata = get_data() # print(json.dumps(jdata, indent=4)) + list_separator = "," showed = config["report.list.columns"].split(list_separator) if not showed: show_only = None