-
Couldn't load subscription status.
- Fork 0
Description
Parent Epic: #34 - Implement Create Environment Command
Depends On: #40 - Template System Integration
Status: OPTIONAL ENHANCEMENT
Estimated Time: 1-2 hours
⚠️ Note: This is an optional enhancement that can be deferred. It requires #40 (Template System Integration) to be completed first.
Overview
Implement the template subcommand for the create command, allowing users to generate configuration file templates. This enhances user experience by providing a starting point for configuration creation.
Goals
- Implement
templatesubcommand in the create command structure - Generate JSON configuration template files
- Support custom output paths for template generation
- Provide helpful placeholder content with clear replacement instructions
- Integrate with existing CLI subcommand architecture
Architecture Requirements
DDD Layer: Presentation (CLI interface) + Infrastructure (template generation)
Module Path: src/presentation/console/subcommands/create/ + src/infrastructure/templates/
Pattern: CLI Subcommand + Template Generation
Dependencies: Requires #40 (Template System Integration) to be completed first.
CLI Interface
# Generate template configuration file (JSON format)
torrust-tracker-deployer create template
# Creates: ./environment-template.json in current working directory
# Generate template in specific directory
torrust-tracker-deployer create template ./config/environment.json
# Generate template with custom filename
torrust-tracker-deployer create template ./my-environment.json
# Show help for template subcommand
torrust-tracker-deployer create template --helpTemplate Example
{
"environment": {
"name": "my-environment"
},
"ssh_credentials": {
"private_key_path": "~/.ssh/id_rsa",
"public_key_path": "~/.ssh/id_rsa.pub",
"username": "torrust",
"port": 22
}
}Acceptance Criteria
-
create templatesubcommand generates valid JSON template - Template includes helpful placeholder values
- Template includes comments explaining each field (if JSON supports it, or in separate docs)
- Custom output paths are supported
- Default filename is
environment-template.json - Error handling follows tiered help system pattern
- Help text provides clear usage examples
Implementation Notes
- Extend existing CLI subcommand structure from Subissue 3
- Use TemplateManager from Subissue 6 for template generation
- Follow existing patterns for CLI subcommands
- Ensure template content matches environment configuration schema
For detailed specification, see: docs/issues/epic-create-environment-command-subissue-7-template-generation-support.md