From 1168d2802b94c2bbcccf569424cc1b53f387e55e Mon Sep 17 00:00:00 2001 From: Elias Bachaalany Date: Thu, 4 Jan 2024 19:11:40 -0800 Subject: [PATCH] idxtool: show GPTs count in the TOC generator --- .scripts/idxtool.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.scripts/idxtool.py b/.scripts/idxtool.py index 84d9b61..ca41618 100755 --- a/.scripts/idxtool.py +++ b/.scripts/idxtool.py @@ -109,12 +109,16 @@ def rebuild_toc(toc_out: str = '') -> Tuple[bool, str]: except: return (False, f"Failed to open '{toc_out}' for writing.") + # Count GPTs + enumerated_gpts = list(enum_gpts()) + ok_count = sum(1 for ok, _ in enumerated_gpts if ok) + # Write the marker line and each GPT entry - out.append(f"{TOC_GPT_MARKER_LINE}\n") + out.append(f"{TOC_GPT_MARKER_LINE} ({ok_count} total)\n") nb_ok = nb_total = 0 gpts = [] - for ok, gpt in enum_gpts(): + for ok, gpt in enumerated_gpts: nb_total += 1 if ok: if gpt_id := gpt.id():