работа с шаблонами

This commit is contained in:
Mikan
2025-12-08 17:18:30 +03:00
parent 1dbd05e57e
commit c262bffb41
6 changed files with 94 additions and 17 deletions

View File

@@ -1,16 +1,22 @@
from typing import Optional
import typer
from pathlib import Path
from .core.converter import process_document
app = typer.Typer()
import logging
@app.command()
def convert(
input_dir: Path = typer.Option(..., "--input", "-i", help="Папка с исходниками"),
output_dir: Path = typer.Option(..., "--output", "-o", help="Папка для результата"),
style_config: Path = typer.Option("resources/style_config.yaml", "--style", "-s", help="Файл стилей")
style_config: Path = typer.Option("resources/style_config.yaml", "--style", "-s", help="Файл стилей"),
template: Optional[Path] = typer.Option(None, "--template", "-t", help="Шаблон .dotx"),
verbose: bool = typer.Option(False, "--verbose", "-v", help="Включить отладочные сообщения"),
):
process_document(input_dir, output_dir, style_config)
log_level = logging.DEBUG if verbose else logging.INFO
logging.basicConfig(level=log_level, format='%(levelname)s: %(message)s')
if __name__ == "__main__":
app()
process_document(input_dir, output_dir, style_config, template)