modo
This commit is contained in:
parent
279b45b1ee
commit
7907bee106
14
README.md
14
README.md
@ -5,18 +5,24 @@ A suite of tools for dealing with a directory of markdown files.
|
|||||||
## Tasks
|
## Tasks
|
||||||
|
|
||||||
- TODO: improve inline help
|
- TODO: improve inline help
|
||||||
- TODO: more flags
|
- DONE: more flags
|
||||||
- [x] filters
|
- [x] filters
|
||||||
- [x] sorting
|
- [x] sorting
|
||||||
- [ ] reverse sort
|
- [x] reverse sort
|
||||||
- TODO: add config file {by:2024-08-01}
|
- TODO: add config file {by:2024-09-01}
|
||||||
- [ ] make file types configurable
|
- [ ] make file types configurable
|
||||||
- [ ] look in local dir, then XDG_HOME
|
- [ ] look in local dir, then XDG_HOME
|
||||||
- DONE: support checkboxes
|
- DONE: support checkboxes
|
||||||
- [x] scan lists
|
- [x] scan lists
|
||||||
- [x] percent complete
|
- [x] percent complete
|
||||||
- DONE: decide on more permanent name {by:2024-08-15}
|
|
||||||
- IDEA: recurring?
|
- IDEA: recurring?
|
||||||
- IDEA: track changes
|
- IDEA: track changes
|
||||||
|
- IDEA: modify files
|
||||||
|
- [ ] quick add
|
||||||
|
- [ ] check box -> completion
|
||||||
|
- [ ] finish (assigned temp tags?)
|
||||||
|
- [ ] sort in file
|
||||||
|
maybe requires a special section like ## Tasks
|
||||||
|
- DONE: decide on more permanent name {by:2024-08-15}
|
||||||
- DONE: add color {by: 2024-07-26}
|
- DONE: add color {by: 2024-07-26}
|
||||||
- DONE: support multi-tags {like:this} {by: 2024-07-26}
|
- DONE: support multi-tags {like:this} {by: 2024-07-26}
|
||||||
|
@ -33,7 +33,7 @@ TODO_TODO_RE = re.compile(
|
|||||||
|
|
||||||
def get_files(dirname):
|
def get_files(dirname):
|
||||||
if not dirname:
|
if not dirname:
|
||||||
dirname = "~/wiki/"
|
dirname = "."
|
||||||
else:
|
else:
|
||||||
dirname = dirname[0]
|
dirname = dirname[0]
|
||||||
p = pathlib.Path(dirname).expanduser()
|
p = pathlib.Path(dirname).expanduser()
|
||||||
@ -55,6 +55,19 @@ def lod_table(data: list["TodoItem"]) -> Table | str:
|
|||||||
return table
|
return table
|
||||||
|
|
||||||
|
|
||||||
|
def do_sorting(output, sort, default_sort, sort_factory):
|
||||||
|
reverse = False
|
||||||
|
if not sort:
|
||||||
|
sort = default_sort
|
||||||
|
else:
|
||||||
|
if sort[0] == "-":
|
||||||
|
reverse = True
|
||||||
|
sort = sort[1:]
|
||||||
|
sort = sort.split(",")
|
||||||
|
sort_func = sort_factory(sort)
|
||||||
|
output.sort(key=sort_func, reverse=reverse)
|
||||||
|
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
def cli():
|
def cli():
|
||||||
pass
|
pass
|
||||||
@ -210,12 +223,7 @@ def todos(dirname, sort, filter):
|
|||||||
output = apply_filter(output, rule)
|
output = apply_filter(output, rule)
|
||||||
|
|
||||||
# do sorting
|
# do sorting
|
||||||
if not sort:
|
do_sorting(output, sort, ["status", "due"], get_todo_sort_func)
|
||||||
sort = ["status", "due"]
|
|
||||||
else:
|
|
||||||
sort = sort.split(",")
|
|
||||||
sort_func = get_todo_sort_func(sort)
|
|
||||||
output.sort(key=sort_func)
|
|
||||||
|
|
||||||
# display
|
# display
|
||||||
table = lod_table(output)
|
table = lod_table(output)
|
||||||
@ -303,12 +311,7 @@ def ls(dirname, sort):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# sort
|
# sort
|
||||||
if not sort:
|
do_sorting(output, sort, ["file", "modified"], get_ls_sort_func)
|
||||||
sort = ["file", "modified"]
|
|
||||||
else:
|
|
||||||
sort = sort.split(",")
|
|
||||||
sort_func = get_ls_sort_func(sort)
|
|
||||||
output.sort(key=sort_func)
|
|
||||||
|
|
||||||
# display
|
# display
|
||||||
table = lod_table(output)
|
table = lod_table(output)
|
||||||
|
Loading…
Reference in New Issue
Block a user