You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- El token debe tener permisos suficientes para acceder a repositorios privados y activar flujos de trabajo.
349
349
- Los errores durante la ejecución (por ejemplo, archivos faltantes o permisos insuficientes) se registrarán en la consola.
350
350
351
+
## 🪝 Ganchos de Pre-generación y Post-generación
352
+
353
+
Puedes definir comandos de shell para ejecutar antes y después de la generación de la estructura usando las claves `pre_hooks` y `post_hooks` en tu configuración YAML. Son opcionales y te permiten automatizar pasos de preparación o limpieza.
354
+
355
+
- **pre_hooks**: Lista de comandos de shell a ejecutar antes de la generación. Si algún comando falla (código distinto de cero), la generación se aborta.
356
+
- **post_hooks**: Lista de comandos de shell a ejecutar después de completar la generación. Si algún comando falla, se muestra un error.
357
+
358
+
Ejemplo:
359
+
360
+
```yaml
361
+
pre_hooks:
362
+
- echo "Preparando el entorno..."
363
+
- ./scripts/prep.sh
364
+
365
+
post_hooks:
366
+
- echo "¡Generación completa!"
367
+
- ./scripts/cleanup.sh
368
+
files:
369
+
- README.md:
370
+
content: |
371
+
# Mi Proyecto
372
+
```
373
+
374
+
**Notas:**
375
+
376
+
- La salida de los ganchos (stdout y stderr) se muestra en la terminal.
377
+
- Si un pre-hook falla, la generación se detiene.
378
+
- Si no se definen hooks, no ocurre nada extra.
379
+
351
380
## 👩💻 Desarrollo
352
381
353
382
Para comenzar con el desarrollo, sigue estos pasos:
Copy file name to clipboardExpand all lines: README.md
+30-1Lines changed: 30 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@
8
8
9
9
-[Introduction](#-introduction)
10
10
-[Features](#-features)
11
-
-[Installation](#installation)
11
+
-[Installation](#️-installation)
12
12
-[Quick Start](#-quick-start)
13
13
-[Usage](#-usage)
14
14
-[YAML Configuration](#-yaml-configuration)
@@ -417,6 +417,35 @@ struct <Tab>
417
417
- [**Automating Project Structures with STRUCT and GitHub Actions**](https://medium.com/@httpdss/automating-project-structures-with-struct-and-github-actions-64e09c40c11e)
418
418
- [**Advanced STRUCT Tips: Working with Template Variables and Jinja2 Filters**](https://medium.com/@httpdss/advanced-struct-tips-working-with-template-variables-and-jinja2-filters-b239bf3145e4)
419
419
420
+
## 🪝 Pre-generation and Post-generation Hooks
421
+
422
+
You can define shell commands to run before and after structure generation using the `pre_hooks` and `post_hooks` keys in your YAML configuration. These are optional and allow you to automate setup or cleanup steps.
423
+
424
+
- **pre_hooks**: List of shell commands to run before generation. If any command fails (non-zero exit), generation is aborted.
425
+
- **post_hooks**: List of shell commands to run after generation completes. If any command fails, an error is shown.
426
+
427
+
Example:
428
+
429
+
```yaml
430
+
pre_hooks:
431
+
- echo "Preparing environment..."
432
+
- ./scripts/prep.sh
433
+
434
+
post_hooks:
435
+
- echo "Generation complete!"
436
+
- ./scripts/cleanup.sh
437
+
files:
438
+
- README.md:
439
+
content: |
440
+
# My Project
441
+
```
442
+
443
+
**Notes:**
444
+
445
+
- Output from hooks (stdout and stderr) is shown in the terminal.
446
+
- If a pre-hook fails, generation is halted.
447
+
- If no hooks are defined, nothing extra happens.
448
+
420
449
## 📜 License
421
450
422
451
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
0 commit comments