\n"
+ )
+
+ if unlisted_catalog:
+ ok = False
+ print("ā Stubs missing from the HTML catalog (docs/source/environments.md):\n")
+ for slug in unlisted_catalog:
+ print(f" docs/source/environments/{slug}.md")
+ print()
+ print(
+ " Add a card to docs/source/environments.md (copy an existing\n"
+ ' card and link to environments/).\n'
+ )
+
if ok:
print("ā
All environment stubs are present and up to date.")
return 0 if ok else 1
@@ -249,9 +307,14 @@ def main():
env_dirs = get_env_dirs()
stub_mapping = get_existing_stub_mapping()
missing, orphaned, stale, no_readme = analyze(env_dirs, stub_mapping)
+ unlisted_toctree, unlisted_catalog = find_unlisted(stub_mapping, orphaned)
if args.check:
- sys.exit(run_check(missing, orphaned, stale, no_readme))
+ sys.exit(
+ run_check(
+ missing, orphaned, stale, no_readme, unlisted_toctree, unlisted_catalog
+ )
+ )
# --fix and --dry-run
if no_readme:
@@ -261,11 +324,27 @@ def main():
print()
if not missing and not orphaned and not stale:
- print("ā
Everything is already in sync.")
- return
-
- print("Fixing documentation...\n" if not args.dry_run else "Dry run ā no files will be modified:\n")
- run_fix(missing, orphaned, stale, dry_run=args.dry_run)
+ print("ā
All stubs are already in sync.")
+ else:
+ print(
+ "Fixing documentation...\n"
+ if not args.dry_run
+ else "Dry run ā no files will be modified:\n"
+ )
+ run_fix(missing, orphaned, stale, dry_run=args.dry_run)
+
+ # Toctree/catalog entries are managed manually; remind about gaps that
+ # --fix cannot write (including stubs it just created).
+ manual_toctree = sorted(set(unlisted_toctree) | {slug for _, slug in missing})
+ manual_catalog = sorted(set(unlisted_catalog) | {slug for _, slug in missing})
+ if manual_toctree:
+ print("\nā ļø Add these to docs/source/_toctree.yml manually (- local: environments/):")
+ for slug in manual_toctree:
+ print(f" {slug}")
+ if manual_catalog:
+ print("\nā ļø Add a card for these to docs/source/environments.md manually:")
+ for slug in manual_catalog:
+ print(f" {slug}")
if __name__ == "__main__":