-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_config_docs.py
executable file
·44 lines (33 loc) · 1.17 KB
/
generate_config_docs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
"""
Generate configuration documentation from code.
"""
# Standard library imports
import sys
from pathlib import Path
from tracklistify.config import get_config
# Add project root to Python path
project_root = Path(__file__).parent.parent
sys.path.append(str(project_root))
def main():
"""Generate configuration documentation."""
config = get_config()
# Generate documentation
docs_dir = project_root / "docs"
docs_dir.mkdir(exist_ok=True)
# Generate main configuration documentation
output_file = docs_dir / "configuration.md"
documentation = config.generate_documentation(str(output_file))
# Also update .env.example with latest configuration
env_example = project_root / ".env.example"
if not env_example.exists():
print("Warning: .env.example not found")
print(f"Configuration documentation generated at: {output_file}")
print("\nDocumentation preview:")
print("=" * 80)
preview = documentation.split("\n")[:20] # Show first 20 lines
print("\n".join(preview))
print("..." if len(documentation.split("\n")) > 20 else "")
print("=" * 80)
if __name__ == "__main__":
main()