Skip to content

Commit ee05a0c

Browse files
committed
feat: Add support for folder structure and logging enhancements
1 parent eee0e8f commit ee05a0c

4 files changed

Lines changed: 51 additions & 11 deletions

File tree

README.es.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,15 @@ structure:
153153
- src/main.py:
154154
content: |
155155
print("Hello, World!")
156+
folders:
157+
- .devops/modules/mod1:
158+
struct: terraform-module
159+
- .devops/modules/mod2:
160+
struct: terraform-module
161+
- ./:
162+
struct:
163+
- docker-files
164+
- go-project
156165
variables:
157166
- project_name:
158167
description: "The name of the project"

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,15 @@ structure:
150150
- src/main.py:
151151
content: |
152152
print("Hello, World!")
153+
folders:
154+
- .devops/modules/mod1:
155+
struct: terraform-module
156+
- .devops/modules/mod2:
157+
struct: terraform-module
158+
- ./:
159+
struct:
160+
- docker-files
161+
- go-project
153162
variables:
154163
- project_name:
155164
description: "The name of the project"

example/structure.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ structure:
2121
- uses: actions/checkout@{{@ "actions/checkout" | latest_release @}}
2222
- name: Run a one-line script
2323
run: echo Hello, world!
24+
folders:
25+
- .devops/modules/mod1:
26+
struct: terraform-module
27+
- .devops/modules/mod2:
28+
struct: terraform-module
29+
- ./:
30+
struct:
31+
- docker-files
32+
- go-project
2433
variables:
2534
- project_name:
2635
description: 'The name of the project.'

struct_module/commands/generate.py

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,29 @@ def _create_structure(self, args):
9292
# check if content has struct value
9393
if 'struct' in content:
9494
self.logger.info(f"Generating structure in folder: {folder} with struct {content['struct']}")
95-
self._create_structure({
96-
'structure_definition': content['struct'],
97-
'base_path': folder_path,
98-
'structures_path': args.structures_path,
99-
'dry_run': args.dry_run,
100-
'vars': args.vars,
101-
'backup': args.backup,
102-
'file_strategy': args.file_strategy,
103-
'global_system_prompt': args.global_system_prompt,
104-
})
105-
self.logger.info(f"Generated structure in folder: {folder} with struct {content['struct']}")
95+
if isinstance(content['struct'], str):
96+
97+
self._create_structure({
98+
'structure_definition': content['struct'],
99+
'base_path': folder_path,
100+
'structures_path': args.structures_path,
101+
'dry_run': args.dry_run,
102+
'vars': args.vars,
103+
'backup': args.backup,
104+
'file_strategy': args.file_strategy,
105+
'global_system_prompt': args.global_system_prompt,
106+
})
107+
elif isinstance(content['struct'], list):
108+
for struct in content['struct']:
109+
self._create_structure({
110+
'structure_definition': struct,
111+
'base_path': folder_path,
112+
'structures_path': args.structures_path,
113+
'dry_run': args.dry_run,
114+
'vars': args.vars,
115+
'backup': args.backup,
116+
'file_strategy': args.file_strategy,
117+
'global_system_prompt': args.global_system_prompt,
118+
})
106119
else:
107120
self.logger.warning(f"Unsupported content in folder: {folder}")

0 commit comments

Comments
 (0)