Files
md-to-docx/src/__main__.py

23 lines
1.0 KiB
Python
Raw Normal View History

2025-12-08 17:18:30 +03:00
from typing import Optional
2025-12-08 16:57:25 +03:00
import typer
from pathlib import Path
from .core.converter import process_document
app = typer.Typer()
2025-12-08 17:18:30 +03:00
import logging
2025-12-08 16:57:25 +03:00
@app.command()
def convert(
input_dir: Path = typer.Option(..., "--input", "-i", help="Папка с исходниками"),
output_dir: Path = typer.Option(..., "--output", "-o", help="Папка для результата"),
2025-12-08 17:18:30 +03:00
style_config: Path = typer.Option("resources/style_config.yaml", "--style", "-s", help="Файл стилей"),
template: Optional[Path] = typer.Option(None, "--template", "-t", help="Шаблон .dotx"),
2025-12-08 17:21:41 +03:00
theme: Optional[str] = typer.Option(None, "--theme", "-T", help="Название темы (gost, academic...)"),
2025-12-08 17:18:30 +03:00
verbose: bool = typer.Option(False, "--verbose", "-v", help="Включить отладочные сообщения"),
2025-12-08 16:57:25 +03:00
):
2025-12-08 17:18:30 +03:00
log_level = logging.DEBUG if verbose else logging.INFO
logging.basicConfig(level=log_level, format='%(levelname)s: %(message)s')
2025-12-08 16:57:25 +03:00
2025-12-08 17:21:41 +03:00
process_document(input_dir, output_dir, style_config, template, theme)