Browse Source

lazygit

main^2
Gregory Leeman 6 months ago
parent
commit
321017a13b
  1. 28
      wf/script.py

28
wf/script.py

@ -535,14 +535,16 @@ def find_project_by_id(project_data, full_data, target_id): # {{{
# }}}
def show(parent_id, flat=False, filters=None, color="grey", follow_mirrors=False, include_headers=False, show_description=True, show_id=False): # {{{
def show(parent_id, flat=False, filters_all=None, filters_any=None, color="grey", follow_mirrors=False, include_headers=False, show_description=True, show_id=False): # {{{
root_data = load_from_storage("root")
project_data, root_data = find_project_by_id(root_data, root_data, parent_id)
project_data, root_data = simplify_project(project_data, root_data, follow_mirrors=follow_mirrors)
if flat:
project_data = flatten_project(project_data)
if filters is not None:
project_data = filter_project_all(project_data, filters, include_headers=include_headers)
if filters_all is not None:
project_data = filter_project_all(project_data, filters_all, include_headers=include_headers)
if filters_any is not None:
project_data = filter_project_any(project_data, filters_any, include_headers=include_headers)
project_data = replace(project_data, r" *<", "<")
project_data = replace(project_data, r" *$", "")
project_data = recolor(project_data, colors2)
@ -582,12 +584,17 @@ def main(): # {{{
inbox_parser.add_argument("name", help="Item text", nargs="*")
tasks_parser = subparsers.add_parser("tasks", help="Tasks commands")
tasks_parser.add_argument("filter", help="Filter text", nargs="*", default=None)
tasks_parser.add_argument("--hide-comments", action="store_true", help="Do not show comments")
tasks_parser.add_argument("--flat", action="store_true", help="Show flat list")
tasks_parser.add_argument("--hide-headers", action="store_true", help="Hide headers")
tasks_parser.add_argument("--show-id", action="store_true", help="Show item id")
today_parser = subparsers.add_parser("today", help="Today commands")
today_parser.add_argument("filter", help="Filter text", nargs="*", default=None)
today_parser.add_argument("--hide-comments", action="store_true", help="Do not show comments")
today_parser.add_argument("--flat", action="store_true", help="Show flat list")
today_parser.add_argument("--hide-headers", action="store_true", help="Hide headers")
today_parser.add_argument("--show-id", action="store_true", help="Show item id")
subparsers.add_parser("dump", help="Dump storage")
subparsers.add_parser("refresh", help="Refresh session cookie and Workflowy data")
@ -626,16 +633,21 @@ def main(): # {{{
if args.filter:
if args.filter == ["today"]:
t = get_today()
show(TASKS_ID, filters=[t], flat=True, follow_mirrors=True, include_headers=True, show_description=not args.hide_comments, show_id=args.show_id)
show(TASKS_ID, filters_all=[t], flat=True, follow_mirrors=True, include_headers=True, show_description=not args.hide_comments, show_id=args.show_id)
else:
show(TASKS_ID, filters=args.filter, flat=True, follow_mirrors=True, include_headers=True, show_description=not args.hide_comments, show_id=args.show_id)
show(TASKS_ID, filters_all=args.filter, flat=True, follow_mirrors=True, include_headers=True, show_description=not args.hide_comments, show_id=args.show_id)
else:
show(TASKS_ID, follow_mirrors=True, show_description=not args.hide_comments, show_id=args.show_id)
if args.command == "today":
t = get_today()
for planner_name, PLANNER_ID in PLANNER_IDS.items():
if args.command == planner_name:
if args.filter:
show(PLANNER_ID, filters=args.filter, show_description=not args.hide_comments, flat=args.flat, include_headers=not args.hide_headers, show_id=args.show_id)
show(PLANNER_ID, filters_all=args.filter, show_description=not args.hide_comments, flat=args.flat, include_headers=not args.hide_headers, show_id=args.show_id)
else:
show(PLANNER_ID, show_description=not args.hide_comments, flat=args.flat, include_headers=not args.hide_headers, show_id=args.show_id)

Loading…
Cancel
Save