Fetch all docs and show how they would be mapped.
(self)
| 291 | json.dump(index_data, f, ensure_ascii=False, indent=2) |
| 292 | |
| 293 | def list_structure(self) -> None: |
| 294 | """Fetch all docs and show how they would be mapped.""" |
| 295 | print("\nFetching all docs to analyze structure...\n") |
| 296 | docs = self.get_all_docs() |
| 297 | print(f"\nTotal docs: {len(docs)}\n") |
| 298 | |
| 299 | path_counts: Dict[str, int] = {} |
| 300 | for doc in docs: |
| 301 | link = doc.get("link", "") |
| 302 | output_path, _ = self.detect_output_path(link) |
| 303 | path_counts[output_path] = path_counts.get(output_path, 0) + 1 |
| 304 | |
| 305 | print("Mapping summary:") |
| 306 | for path, count in sorted(path_counts.items()): |
| 307 | print(f" {path:<50} {count:3d} docs") |
| 308 | print(f"\n Total: {len(docs)} docs across {len(path_counts)} directories") |
| 309 | |
| 310 | def migrate(self, url_filter: Optional[str] = None) -> None: |
| 311 | """Main migration entry point.""" |
no test coverage detected