From ad49c664d66e20e930a83027af47bbdf4f0e4db8 Mon Sep 17 00:00:00 2001 From: Kenneth Belitzky Date: Sat, 13 Jul 2024 22:03:29 -0300 Subject: [PATCH] chore: Update template variables in structure.yaml and main.py --- example/structure.yaml | 4 ++-- struct_module/main.py | 1 + tests/__init__.py | 0 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 tests/__init__.py diff --git a/example/structure.yaml b/example/structure.yaml index c7e2745..8dd56c0 100644 --- a/example/structure.yaml +++ b/example/structure.yaml @@ -1,13 +1,13 @@ structure: - README.md: content: | - # {project_name} + # ${project_name} This is a template repository. - script.sh: permissions: '0777' content: | #!/bin/bash - echo "Hello, {author_name}!" + echo "Hello, ${author_name}!" - LICENSE: file: https://raw.githubusercontent.com/nishanths/license/master/LICENSE - .gitignore: diff --git a/struct_module/main.py b/struct_module/main.py index 0367c83..daa48bc 100644 --- a/struct_module/main.py +++ b/struct_module/main.py @@ -78,6 +78,7 @@ def apply_template_variables(self, template_vars): if self.content and template_vars: logging.debug(f"Applying template variables: {template_vars}") template = Template(self.content) + print(template.substitute(template_vars)) self.content = template.substitute(template_vars) def create(self, base_path, dry_run=False, backup_path=None, file_strategy='overwrite'): diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29