Skip to content

Conversation

@cbrgm
Copy link
Owner

@cbrgm cbrgm commented Jan 27, 2026

Summary

  • Adds overwrite field to FileStructure that controls whether existing files should be overwritten during render
  • When set to false, files that already exist on disk will be skipped, preserving user customizations
  • Useful for files like .env configurations that users customize after initial generation

Changes

  • Add Overwrite *bool field to FileStructure (defaults to true if nil for backwards compatibility)
  • Add StatusSkipped and cyan "skip:" output in diff
  • Add applySkipLogic() to classify files based on existence and overwrite setting
  • Propagate overwrite setting through directory processing
  • Add comprehensive tests for the new functionality
  • Update example config with overwrite: false demonstration

Usage

templateGroups:
  config:
    - destination: "config/.env"
      content: |
        API_KEY=changeme
        DATABASE_URL=changeme
      permissions: "0600"
      overwrite: false  # Protect user customizations

Behavior

overwrite File exists Result
nil (default) Yes Overwrite
true Yes Overwrite
false Yes Skip (preserve existing)
false No Create (file doesn't exist yet)

Closes #34

Add `overwrite` field to FileStructure that controls whether existing
files should be overwritten during render. When set to `false`, files
that already exist on disk will be skipped, preserving user customizations.

This is useful for files like .env configurations that users customize
after initial generation.

- Add `Overwrite *bool` field to FileStructure (defaults to true if nil)
- Add `StatusSkipped` and cyan "skip:" output in diff
- Add `applySkipLogic()` to classify files based on existence and setting
- Propagate overwrite setting through directory processing
- Add comprehensive tests for the new functionality
- Update example config with overwrite: false demonstration

Closes #34
@cbrgm cbrgm enabled auto-merge January 27, 2026 15:48
@cbrgm cbrgm merged commit a884f7d into main Jan 27, 2026
13 checks passed
@cbrgm cbrgm deleted the feat/add-overwrite-option branch January 27, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setting Started Features

2 participants