idxtool: show GPTs count in the TOC generator
This commit is contained in:
@@ -109,12 +109,16 @@ def rebuild_toc(toc_out: str = '') -> Tuple[bool, str]:
|
|||||||
except:
|
except:
|
||||||
return (False, f"Failed to open '{toc_out}' for writing.")
|
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
|
# 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
|
nb_ok = nb_total = 0
|
||||||
gpts = []
|
gpts = []
|
||||||
for ok, gpt in enum_gpts():
|
for ok, gpt in enumerated_gpts:
|
||||||
nb_total += 1
|
nb_total += 1
|
||||||
if ok:
|
if ok:
|
||||||
if gpt_id := gpt.id():
|
if gpt_id := gpt.id():
|
||||||
|
|||||||
Reference in New Issue
Block a user