rename as taskwarrior-deluxe, rm old csv
This commit is contained in:
parent
e88cd1d44c
commit
62c0d2ddfc
6 changed files with 56 additions and 19 deletions
18
.klyban.csv
18
.klyban.csv
|
|
@ -1,18 +0,0 @@
|
||||||
"ID","STATUS","TITLE","DETAILS","TAGS","DEADLINE","TOUCHED"
|
|
||||||
0,"TODO","Use click-option-group","To help sort options in categories in help.","UX,feat","","2023-07-29T17:50:45.638845"
|
|
||||||
1,"TODO","Use click-aliases","To allow for aliases (TBC: user-defined in config file?)","UX,feat","","2023-07-29T17:50:51.310893"
|
|
||||||
2,"DONE","edit existing","When calling edit, populate defaults with existing data.","feat","","2023-07-29T17:51:23.166131"
|
|
||||||
3,"TODO","sanity checks","Check data consistency in load_data and save_data.","core,test","","2023-07-29T17:51:09.870813"
|
|
||||||
4,"TODO","find csv up dir","Try to find .klyban.csv on upper directories if not in the existing one.","data,feat","","2023-07-29T17:50:32.534829"
|
|
||||||
5,"HOLD","semantic tags","Allow tags starting with # to refer to a Github issue if data file is in a git repository having a remote on Github.","github,feat","","2023-07-30T10:25:37.048008"
|
|
||||||
6,"TODO","style metadata","Add a METADATA column to host styling tags.","feat","","2023-07-29T17:49:51.174446"
|
|
||||||
9,"TODO","fix add","'add' should prompt for columns content.","bug","","2023-07-29T17:49:19.286464"
|
|
||||||
10,"DONE","fix delete","'delete' print the kanban not updated","bug","","2023-07-29T17:48:14.950376"
|
|
||||||
11,"TODO","fix quotes","After 'add', empty columns got remaining quotes.","bug","","2023-07-29T17:49:33.862442"
|
|
||||||
12,"TODO","multiple select","Allow to pass several IDs or ranges to commands.","feat","","2023-07-29T17:49:05.411800"
|
|
||||||
13,"DOING","card widgets","Refactor into cards/list of cards with widget classes.","feat","","2023-07-31T09:24:34.469400"
|
|
||||||
14,"DONE","highlight last action","Use a virtual hint column to point to the last touched task.","feat,UX","","2023-07-30T10:20:36.795048"
|
|
||||||
15,"TODO","hide old done tasks","Hide tasks with last status that haven't been touched since a long time.","feat","","2023-07-30T10:16:39.517669"
|
|
||||||
16,"TODO","sort by priority","Add a priority column and a sorting option.","feat","","2023-07-31T09:19:16.258603"
|
|
||||||
17,"TODO","fix layout filtering","When changing themes, the layout filtering hack in Horizontal* does not work anymore.","bug","","2023-07-31T17:40:15.708249"
|
|
||||||
18,"TODO","normalized config files","Handle config files: 1) current dir, 2) upper dir(s) stack, 3) home config, 4) system config, 5) command line","feat","","2023-08-04T19:47:29.684559"
|
|
||||||
|
11
.task/backlog.data
Normal file
11
.task/backlog.data
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
{"description":"find data updir: try to find .task on upper directories if not in the existing one","entry":"20230811T170621Z","modified":"20230811T170621Z","status":"pending","uuid":"b4ee0b55-0bb3-4a2f-b7c5-87cd70dd0ff0","tags":["data","feat"]}
|
||||||
|
{"description":"semantic Allow tags starting with","entry":"20230811T170722Z","modified":"20230811T170722Z","status":"pending","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":"20230811T170911Z","modified":"20230811T170911Z","status":"pending","uuid":"e18707b4-304d-41f3-8504-89476cd796f5","tags":["feat"]}
|
||||||
|
{"description":"sort by urgency","entry":"20230811T170942Z","modified":"20230811T170942Z","status":"pending","uuid":"4f041f52-739a-4aca-94e6-164f43e61866","tags":["feat"]}
|
||||||
|
{"description":"config file.s","entry":"20230811T171231Z","modified":"20230811T171231Z","status":"pending","uuid":"4d822c4a-d51e-4992-8a22-6e0167ac197a","tags":["feat"]}
|
||||||
|
{"description":"fix escaped add: when passing add with escapable characters, bug ensues.","entry":"20230811T171437Z","modified":"20230811T171437Z","status":"pending","uuid":"79e1ba11-15ae-489f-9868-ab6adea40a91","tags":["bug"]}
|
||||||
|
{"description":"semantig allow tags starting with a hash to refer to a github issue or PR","entry":"20230811T170722Z","modified":"20230811T171557Z","status":"pending","uuid":"06cf70a9-4f0e-4b32-b7bb-d1799803665c","tags":["feat"]}
|
||||||
|
{"description":"allow tags starting with a hash to refer to a github issue or PR","entry":"20230811T170722Z","modified":"20230811T171615Z","status":"pending","uuid":"06cf70a9-4f0e-4b32-b7bb-d1799803665c","tags":["feat"]}
|
||||||
|
{"description":"tags starting with a hash to refer to a github issue or PR","entry":"20230811T170722Z","modified":"20230811T171630Z","status":"pending","uuid":"06cf70a9-4f0e-4b32-b7bb-d1799803665c","tags":["feat"]}
|
||||||
|
{"description":"semantic allow tags starting with a hash to refer to a github issue or PR","entry":"20230811T170722Z","modified":"20230811T171645Z","status":"pending","uuid":"06cf70a9-4f0e-4b32-b7bb-d1799803665c","tags":["feat"]}
|
||||||
|
{"description":"semantic tags : allow tags starting with a hash to refer to a github issue or PR","entry":"20230811T170722Z","modified":"20230811T171703Z","status":"pending","uuid":"06cf70a9-4f0e-4b32-b7bb-d1799803665c","tags":["feat"]}
|
||||||
0
.task/completed.data
Normal file
0
.task/completed.data
Normal file
6
.task/pending.data
Normal file
6
.task/pending.data
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
[description:"find data updir: try to find .task on upper directories if not in the existing one" entry:"1691773581" modified:"1691773581" 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:"1691774223" 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:"1691773751" status:"pending" tags:"feat" tags_feat:"x" uuid:"e18707b4-304d-41f3-8504-89476cd796f5"]
|
||||||
|
[description:"sort by urgency" entry:"1691773782" modified:"1691773782" status:"pending" tags:"feat" tags_feat:"x" uuid:"4f041f52-739a-4aca-94e6-164f43e61866"]
|
||||||
|
[description:"config file.s" entry:"1691773951" modified:"1691773951" status:"pending" tags:"feat" tags_feat:"x" uuid:"4d822c4a-d51e-4992-8a22-6e0167ac197a"]
|
||||||
|
[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"]
|
||||||
38
.task/undo.data
Normal file
38
.task/undo.data
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
time 1691773581
|
||||||
|
new [description:"find data updir: try to find .task on upper directories if not in the existing one" entry:"1691773581" modified:"1691773581" status:"pending" tags:"data,feat" tags_data:"x" tags_feat:"x" uuid:"b4ee0b55-0bb3-4a2f-b7c5-87cd70dd0ff0"]
|
||||||
|
---
|
||||||
|
time 1691773642
|
||||||
|
new [description:"semantic Allow tags starting with" entry:"1691773642" modified:"1691773642" status:"pending" uuid:"06cf70a9-4f0e-4b32-b7bb-d1799803665c"]
|
||||||
|
---
|
||||||
|
time 1691773751
|
||||||
|
new [description:"hide old done tasks: Hide tasks with last status that haven t been touched since a long time." entry:"1691773751" modified:"1691773751" status:"pending" tags:"feat" tags_feat:"x" uuid:"e18707b4-304d-41f3-8504-89476cd796f5"]
|
||||||
|
---
|
||||||
|
time 1691773782
|
||||||
|
new [description:"sort by urgency" entry:"1691773782" modified:"1691773782" status:"pending" tags:"feat" tags_feat:"x" uuid:"4f041f52-739a-4aca-94e6-164f43e61866"]
|
||||||
|
---
|
||||||
|
time 1691773951
|
||||||
|
new [description:"config file.s" entry:"1691773951" modified:"1691773951" status:"pending" tags:"feat" tags_feat:"x" uuid:"4d822c4a-d51e-4992-8a22-6e0167ac197a"]
|
||||||
|
---
|
||||||
|
time 1691774077
|
||||||
|
new [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"]
|
||||||
|
---
|
||||||
|
time 1691774157
|
||||||
|
old [description:"semantic Allow tags starting with" entry:"1691773642" modified:"1691773642" status:"pending" uuid:"06cf70a9-4f0e-4b32-b7bb-d1799803665c"]
|
||||||
|
new [description:"semantig allow tags starting with a hash to refer to a github issue or PR" entry:"1691773642" modified:"1691774157" status:"pending" tags:"feat" tags_feat:"x" uuid:"06cf70a9-4f0e-4b32-b7bb-d1799803665c"]
|
||||||
|
---
|
||||||
|
time 1691774175
|
||||||
|
old [description:"semantig allow tags starting with a hash to refer to a github issue or PR" entry:"1691773642" modified:"1691774157" status:"pending" tags:"feat" tags_feat:"x" uuid:"06cf70a9-4f0e-4b32-b7bb-d1799803665c"]
|
||||||
|
new [description:"allow tags starting with a hash to refer to a github issue or PR" entry:"1691773642" modified:"1691774175" status:"pending" tags:"feat" tags_feat:"x" uuid:"06cf70a9-4f0e-4b32-b7bb-d1799803665c"]
|
||||||
|
---
|
||||||
|
time 1691774190
|
||||||
|
old [description:"allow tags starting with a hash to refer to a github issue or PR" entry:"1691773642" modified:"1691774175" status:"pending" tags:"feat" tags_feat:"x" uuid:"06cf70a9-4f0e-4b32-b7bb-d1799803665c"]
|
||||||
|
new [description:"tags starting with a hash to refer to a github issue or PR" entry:"1691773642" modified:"1691774190" status:"pending" tags:"feat" tags_feat:"x" uuid:"06cf70a9-4f0e-4b32-b7bb-d1799803665c"]
|
||||||
|
---
|
||||||
|
time 1691774205
|
||||||
|
old [description:"tags starting with a hash to refer to a github issue or PR" entry:"1691773642" modified:"1691774190" status:"pending" tags:"feat" tags_feat:"x" uuid:"06cf70a9-4f0e-4b32-b7bb-d1799803665c"]
|
||||||
|
new [description:"semantic allow tags starting with a hash to refer to a github issue or PR" entry:"1691773642" modified:"1691774205" status:"pending" tags:"feat" tags_feat:"x" uuid:"06cf70a9-4f0e-4b32-b7bb-d1799803665c"]
|
||||||
|
---
|
||||||
|
time 1691774223
|
||||||
|
old [description:"semantic allow tags starting with a hash to refer to a github issue or PR" entry:"1691773642" modified:"1691774205" status:"pending" tags:"feat" tags_feat:"x" uuid:"06cf70a9-4f0e-4b32-b7bb-d1799803665c"]
|
||||||
|
new [description:"semantic tags : allow tags starting with a hash to refer to a github issue or PR" entry:"1691773642" modified:"1691774223" status:"pending" tags:"feat" tags_feat:"x" uuid:"06cf70a9-4f0e-4b32-b7bb-d1799803665c"]
|
||||||
|
---
|
||||||
349
twd.py
Executable file
349
twd.py
Executable file
|
|
@ -0,0 +1,349 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
import argparse
|
||||||
|
import textwrap
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
import rich
|
||||||
|
# For some reason this is not imported by the command above.
|
||||||
|
from rich.console import Console
|
||||||
|
from rich.columns import Columns
|
||||||
|
|
||||||
|
class Widget:
|
||||||
|
def __init__(self, order, group = None):
|
||||||
|
self.order = order
|
||||||
|
self.group = group
|
||||||
|
|
||||||
|
class Tasker(Widget):
|
||||||
|
def __init__(self, show_only, order, group = None, touched = []):
|
||||||
|
super().__init__(order, group)
|
||||||
|
self.show_only = show_only
|
||||||
|
self.touched = touched
|
||||||
|
|
||||||
|
def __call__(self, task):
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
class Stacker(Widget):
|
||||||
|
def __init__(self, tasker, order, group):
|
||||||
|
super().__init__(order, group)
|
||||||
|
self.tasker = tasker
|
||||||
|
|
||||||
|
def __call__(self, tasks):
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
class Sectioner(Widget):
|
||||||
|
def __init__(self, stacker, order, group):
|
||||||
|
super().__init__(order, group)
|
||||||
|
self.stacker = stacker
|
||||||
|
|
||||||
|
def __call__(self, tasks):
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
|
class task:
|
||||||
|
class Card(Tasker):
|
||||||
|
def __init__(self, show_only, order = None, touched = [], wrap_width = 25):
|
||||||
|
super().__init__(show_only, order, group = None, touched = touched)
|
||||||
|
self.wrap_width = wrap_width
|
||||||
|
|
||||||
|
def __call__(self, task):
|
||||||
|
if not self.show_only:
|
||||||
|
# Show all existing fields.
|
||||||
|
self.show_only = task.keys()
|
||||||
|
|
||||||
|
sid = str(task["id"])
|
||||||
|
if ':' in task["description"]:
|
||||||
|
short, desc = task["description"].split(":")
|
||||||
|
title = ":".join([sid,short.strip()])
|
||||||
|
else:
|
||||||
|
desc = task["description"]
|
||||||
|
title = sid
|
||||||
|
|
||||||
|
desc = "\n".join(textwrap.wrap(desc.strip(), self.wrap_width))
|
||||||
|
|
||||||
|
if sid in touched:
|
||||||
|
title = "*"+title+"*"
|
||||||
|
|
||||||
|
segments = []
|
||||||
|
for key in self.show_only:
|
||||||
|
if key in task.keys() and key not in ["id", "description"]:
|
||||||
|
val = task[key]
|
||||||
|
segment = f"{key}: "
|
||||||
|
if type(val) == str:
|
||||||
|
segments.append(segment+t)
|
||||||
|
elif type(val) == list:
|
||||||
|
# FIXME Columns does not fit.
|
||||||
|
# g = Columns([f"+{t}" for t in val], expand = False)
|
||||||
|
g = rich.console.Group(*[f"+{t}" for t in val], fit = True)
|
||||||
|
segments.append(g)
|
||||||
|
else:
|
||||||
|
segments.append(segment+str(val))
|
||||||
|
|
||||||
|
# FIXME Columns does not fit.
|
||||||
|
# cols = Columns(segments)
|
||||||
|
cols = rich.console.Group(*segments, fit = True)
|
||||||
|
grp = rich.console.Group(desc, cols, fit = True)
|
||||||
|
panel = rich.panel.Panel(grp, title = title,
|
||||||
|
title_align="left", expand = False, padding = (0,1))
|
||||||
|
|
||||||
|
return panel
|
||||||
|
|
||||||
|
class Raw(Tasker):
|
||||||
|
def __init__(self, show_only, order = None, touched = []):
|
||||||
|
super().__init__(show_only, order, group = None, touched = touched)
|
||||||
|
|
||||||
|
def __call__(self, task):
|
||||||
|
if not self.show_only:
|
||||||
|
# Show all existing fields.
|
||||||
|
self.show_only = task.keys()
|
||||||
|
|
||||||
|
raw = {}
|
||||||
|
for k in self.show_only:
|
||||||
|
if k in task:
|
||||||
|
raw[k] = task[k]
|
||||||
|
else:
|
||||||
|
raw[k] = None
|
||||||
|
|
||||||
|
return raw
|
||||||
|
|
||||||
|
class stack:
|
||||||
|
class RawTable(Stacker):
|
||||||
|
def __init__(self, tasker):
|
||||||
|
super().__init__(tasker, order = None, group = None)
|
||||||
|
|
||||||
|
def __call__(self, tasks):
|
||||||
|
keys = self.tasker.show_only
|
||||||
|
|
||||||
|
table = rich.table.Table(box = None, show_header = False, show_lines = True, expand = True)
|
||||||
|
table.add_column('H')
|
||||||
|
for k in keys:
|
||||||
|
table.add_column(k)
|
||||||
|
|
||||||
|
for task in tasks:
|
||||||
|
taskers = self.tasker(task)
|
||||||
|
if str(task['id']) in self.tasker.touched:
|
||||||
|
row = ['>']
|
||||||
|
else:
|
||||||
|
row = ['']
|
||||||
|
|
||||||
|
for k in keys:
|
||||||
|
if k in task:
|
||||||
|
val = taskers[k]
|
||||||
|
if type(val) == str:
|
||||||
|
row.append( val )
|
||||||
|
elif type(val) == list:
|
||||||
|
row.append( " ".join(val) )
|
||||||
|
else:
|
||||||
|
row.append( str(val) )
|
||||||
|
else:
|
||||||
|
row.append("")
|
||||||
|
table.add_row(*[str(i) for i in row])
|
||||||
|
return table
|
||||||
|
|
||||||
|
|
||||||
|
class Vertical(Stacker):
|
||||||
|
def __init__(self, tasker):
|
||||||
|
super().__init__(tasker, order = None, group = None)
|
||||||
|
|
||||||
|
def __call__(self, tasks):
|
||||||
|
stack = rich.table.Table(box = None, show_header = False, show_lines = False, expand = True)
|
||||||
|
stack.add_column("Tasks")
|
||||||
|
for task in tasks:
|
||||||
|
stack.add_row( self.tasker(task) )
|
||||||
|
return stack
|
||||||
|
|
||||||
|
class Flat(Stacker):
|
||||||
|
def __init__(self, tasker):
|
||||||
|
super().__init__(tasker, order = None, group = None)
|
||||||
|
|
||||||
|
def __call__(self, tasks):
|
||||||
|
stack = []
|
||||||
|
for task in tasks:
|
||||||
|
stack.append( self.tasker(task) )
|
||||||
|
cols = rich.columns.Columns(stack)
|
||||||
|
return cols
|
||||||
|
|
||||||
|
class sections:
|
||||||
|
class Vertical(Sectioner):
|
||||||
|
def __init__(self, stacker, order, group):
|
||||||
|
super().__init__(stacker, order, group)
|
||||||
|
|
||||||
|
def __call__(self, tasks):
|
||||||
|
sections = []
|
||||||
|
groups = self.group(tasks)
|
||||||
|
for key in self.order():
|
||||||
|
if key in groups:
|
||||||
|
sections.append( rich.panel.Panel(self.stacker(groups[key]), title = key.upper(), title_align = "left", expand = False))
|
||||||
|
return rich.console.Group(*sections)
|
||||||
|
|
||||||
|
class Horizontal(Sectioner):
|
||||||
|
def __init__(self, stacker, order, group):
|
||||||
|
super().__init__(stacker, order, group)
|
||||||
|
|
||||||
|
def __call__(self, tasks):
|
||||||
|
sections = []
|
||||||
|
groups = self.group(tasks)
|
||||||
|
table = rich.table.Table(box = None, show_header = False, show_lines = False)
|
||||||
|
keys = []
|
||||||
|
for key in self.order():
|
||||||
|
if key in groups:
|
||||||
|
table.add_column(key)
|
||||||
|
keys.append(key)
|
||||||
|
|
||||||
|
row = []
|
||||||
|
for k in keys:
|
||||||
|
row.append( rich.panel.Panel(self.stacker(groups[k]), title = k.upper(), title_align = "left", expand = True))
|
||||||
|
|
||||||
|
table.add_row(*row)
|
||||||
|
return table
|
||||||
|
|
||||||
|
class SectionSorter:
|
||||||
|
def __call__(self):
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
class sort:
|
||||||
|
class Tasks:
|
||||||
|
def make(self, tasks, field, reverse = False):
|
||||||
|
return sorted(tasks, key = lambda t: t[field], reverse = reverse)
|
||||||
|
|
||||||
|
class OnValues(SectionSorter):
|
||||||
|
def __init__(self, values):
|
||||||
|
self.values = values
|
||||||
|
|
||||||
|
def __call__(self):
|
||||||
|
return self.values
|
||||||
|
|
||||||
|
class Grouper:
|
||||||
|
"""Group tasks by field values."""
|
||||||
|
def __init__(self, field):
|
||||||
|
self.field = field
|
||||||
|
|
||||||
|
def __call__(self, tasks):
|
||||||
|
groups = {}
|
||||||
|
for task in tasks:
|
||||||
|
if self.field in task:
|
||||||
|
if task[self.field] in groups:
|
||||||
|
groups[ task[self.field] ].append(task)
|
||||||
|
else:
|
||||||
|
groups[ task[self.field] ] = [task]
|
||||||
|
return groups
|
||||||
|
|
||||||
|
class group:
|
||||||
|
class Status(Grouper):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__("status")
|
||||||
|
|
||||||
|
def __call__(self, tasks):
|
||||||
|
groups = {}
|
||||||
|
for task in tasks:
|
||||||
|
if "start" in task:
|
||||||
|
if "started" in groups:
|
||||||
|
groups["started"].append(task)
|
||||||
|
else:
|
||||||
|
groups["started"] = [task]
|
||||||
|
elif self.field in task:
|
||||||
|
if task[self.field] in groups:
|
||||||
|
groups[ task[self.field] ].append(task)
|
||||||
|
else:
|
||||||
|
groups[ task[self.field] ] = [task]
|
||||||
|
|
||||||
|
return groups
|
||||||
|
|
||||||
|
def call_taskwarrior(args:list[str] = ['export']) -> str:
|
||||||
|
# Local file.
|
||||||
|
env = os.environ.copy()
|
||||||
|
env["TASKDATA"] = asked.data
|
||||||
|
|
||||||
|
cmd = ['task'] + args
|
||||||
|
try:
|
||||||
|
p = subprocess.Popen( " ".join(cmd),
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
shell=True,
|
||||||
|
env=env,
|
||||||
|
)
|
||||||
|
out, err = p.communicate()
|
||||||
|
|
||||||
|
except subprocess.CalledProcessError as exc:
|
||||||
|
print("ERROR:", exc.returncode, exc.output, err)
|
||||||
|
sys.exit(exc.returncode)
|
||||||
|
else:
|
||||||
|
return out.decode('utf-8')
|
||||||
|
|
||||||
|
|
||||||
|
def get_data():
|
||||||
|
out = call_taskwarrior(['export'])
|
||||||
|
try:
|
||||||
|
jdata = json.loads(out)
|
||||||
|
except json.decoder.JSONDecodeError as exc:
|
||||||
|
print("ERROR:", exc.returncode, exc.output)
|
||||||
|
else:
|
||||||
|
return jdata
|
||||||
|
|
||||||
|
|
||||||
|
def parse_touched(out):
|
||||||
|
return re.findall('[ModifyingCreated]+ task ([0-9]+)', out)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description="XXX",
|
||||||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument("-s", "--show", metavar="columns", type=str, default="id,description,tags", nargs=1,
|
||||||
|
help="Ordered list of columns to show.")
|
||||||
|
|
||||||
|
config = parser.add_argument_group('configuration options')
|
||||||
|
config.add_argument("-d", "--data", metavar="FILE", type=str, default=".task", nargs=1,
|
||||||
|
help="The input data file.")
|
||||||
|
config.add_argument("--list-separator", metavar="CHARACTER", type=str, default=",", nargs=1,
|
||||||
|
help="Separator used for lists that are passed as options arguments.")
|
||||||
|
|
||||||
|
layouts = parser.add_argument_group('layout options')
|
||||||
|
layouts.add_argument('--card-flat-wrap', metavar="NB", type=int, default=25,
|
||||||
|
help="Number of character at which to wrap the description of Flat Cards.")
|
||||||
|
|
||||||
|
# Capture whatever remains.
|
||||||
|
parser.add_argument('cmd', nargs="*")
|
||||||
|
|
||||||
|
asked = parser.parse_args()
|
||||||
|
|
||||||
|
# First pass arguments to taskwarrior and let it do its magic.
|
||||||
|
out = call_taskwarrior(asked.cmd)
|
||||||
|
if "Description" not in out:
|
||||||
|
print(out.strip())
|
||||||
|
touched = parse_touched(out)
|
||||||
|
# print("Touched:",touched)
|
||||||
|
|
||||||
|
# Then get the resulting data.
|
||||||
|
jdata = get_data()
|
||||||
|
# print(json.dumps(jdata, indent=4))
|
||||||
|
|
||||||
|
showed = asked.show.split(asked.list_separator)
|
||||||
|
if not showed:
|
||||||
|
show_only = None
|
||||||
|
else:
|
||||||
|
show_only = showed
|
||||||
|
|
||||||
|
# tasker = task.Card(show_only, touched = touched, wrap_width = asked.card_flat_wrap)
|
||||||
|
tasker = task.Raw(show_only, touched = touched)
|
||||||
|
|
||||||
|
# stacker = stack.Vertical(tasker)
|
||||||
|
# stacker = stack.Flat(tasker)
|
||||||
|
stacker = stack.RawTable(tasker)
|
||||||
|
|
||||||
|
group_by_status = group.Status()
|
||||||
|
sort_on_values = sort.OnValues(["pending","started","completed"])
|
||||||
|
# sectioner = sections.Vertical(stacker, sort_on_values, group_by_status)
|
||||||
|
sectioner = sections.Horizontal(stacker, sort_on_values, group_by_status)
|
||||||
|
|
||||||
|
console = Console()
|
||||||
|
console.rule("taskwarrior-fancy")
|
||||||
|
console.print(sectioner(jdata))
|
||||||
|
|
||||||
Loading…
Reference in a new issue