Add gantt rendering
This commit is contained in:
@@ -7,7 +7,10 @@ from datetime import date
|
||||
from pathlib import Path
|
||||
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||
|
||||
from rich.console import Console
|
||||
|
||||
from .client import OdooClient, OdooError
|
||||
from .render import render_gantt
|
||||
from .schedule import DAY_NAMES, get_schedules, resolve_employees
|
||||
|
||||
|
||||
@@ -93,6 +96,17 @@ def main() -> int:
|
||||
action="store_true",
|
||||
help="Log each outgoing request (model/method/args, not the response) to stderr",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--gantt",
|
||||
action="store_true",
|
||||
help="Show a compact colored gantt-like grid (one row per employee) instead of the per-day text list",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--details",
|
||||
action="store_true",
|
||||
help="With --gantt, also print the Details section (specific leave/holiday names, pending "
|
||||
"requests) below the grid; off by default",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.date_from > args.date_to:
|
||||
@@ -133,6 +147,12 @@ def main() -> int:
|
||||
print(f"error calling Odoo: {exc}", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
if args.gantt:
|
||||
console = Console()
|
||||
console.print(f"{args.date_from} to {args.date_to} [{tz_name}]\n")
|
||||
render_gantt(console, schedules, employees, args.include_weekends, show_details=args.details)
|
||||
return 0
|
||||
|
||||
for i, emp in enumerate(employees):
|
||||
if i:
|
||||
print()
|
||||
|
||||
Reference in New Issue
Block a user