()
| 205 | # ────────────────────────────────────────────────────────────────────────────── |
| 206 | |
| 207 | def main(): |
| 208 | parser = argparse.ArgumentParser(description='Generate URLab plugin documentation.') |
| 209 | parser.add_argument('--serve', action='store_true', help='Run mkdocs serve after generating') |
| 210 | parser.add_argument('--build', action='store_true', help='Run mkdocs build after generating') |
| 211 | parser.add_argument('--skip-parse', action='store_true', |
| 212 | help='Skip parsing step and reuse existing _parsed_headers.json') |
| 213 | args = parser.parse_args() |
| 214 | |
| 215 | print(f"URLab Docs Generator") |
| 216 | print(f"Plugin root: {PLUGIN_ROOT}") |
| 217 | |
| 218 | # Step 1 |
| 219 | if args.skip_parse and os.path.exists(PARSED_JSON): |
| 220 | print(f"\n─── Step 1: Skipped (using cached {os.path.relpath(PARSED_JSON, PLUGIN_ROOT)}) ───") |
| 221 | with open(PARSED_JSON, 'r', encoding='utf-8') as f: |
| 222 | data = json.load(f) |
| 223 | else: |
| 224 | data = step_parse() |
| 225 | |
| 226 | resolve_inheritance(data) |
| 227 | |
| 228 | # Step 2 |
| 229 | nav_yaml = step_emit(data) |
| 230 | |
| 231 | # Step 3 |
| 232 | step_update_nav(nav_yaml) |
| 233 | |
| 234 | print("\n✅ Documentation generated successfully!") |
| 235 | print(f" Site source: {DOCS_ROOT}") |
| 236 | print(f" To preview: mkdocs serve (run from {PLUGIN_ROOT})") |
| 237 | print(f" To publish: mkdocs gh-deploy") |
| 238 | |
| 239 | # Step 4 (optional) |
| 240 | if args.serve: |
| 241 | step_mkdocs('serve') |
| 242 | elif args.build: |
| 243 | step_mkdocs('build') |
| 244 | |
| 245 | |
| 246 | if __name__ == '__main__': |
no test coverage detected