"""`cf template-xlsx` — создать Excel-шаблон для ручного заполнения модели.""" from pathlib import Path import typer from rich.markup import escape from infrastructure.cli.paths import AppPaths from infrastructure.cli.services import console from infrastructure.i18n import t from infrastructure.repositories import TemplateError, write_template def template_xlsx( path: Path = typer.Argument( AppPaths.from_env().data_dir / "model_template.xlsx", help=t("cmd.template.arg.path"), ), force: bool = typer.Option(False, "--force", "-f", help=t("cmd.template.opt.force")), ) -> None: """Создать Excel-шаблон для заполнения модели""" try: target = write_template(path, force=force) except TemplateError as e: console.print(f"[red]{t('cmd.template.err', error=escape(str(e)))}[/red]") raise typer.Exit(1) console.print(t("cmd.template.ok", path=escape(str(target)))) console.print(t("cmd.template.hint", path=escape(str(target))))