работа с шаблонами
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user