Skip to content

Commit e0cac30

Browse files
committed
Document _copier_conf.operation
1 parent f010d84 commit e0cac30

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

docs/configuring.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,18 @@ to know available options.
858858

859859
The CLI option can be passed several times to add several patterns.
860860

861+
Each pattern can be templated using Jinja.
862+
863+
!!! example
864+
865+
Templating `exclude` patterns using `_copier_conf.operation` allows to have files
866+
that are rendered once during `copy`, but are never updated:
867+
868+
```yaml
869+
_exclude:
870+
- '{%- if _copier_conf.operation == "update" -%}src/*_example.py{%- endif %}'
871+
```
872+
861873
!!! info
862874

863875
When you define this parameter in `copier.yml`, it will **replace** the default
@@ -1316,6 +1328,8 @@ configuring `secret: true` in the [advanced prompt format][advanced-prompt-forma
13161328
exist, but always be present. If they do not exist in a project during an `update`
13171329
operation, they will be recreated.
13181330

1331+
Each pattern can be templated using Jinja.
1332+
13191333
!!! example
13201334

13211335
For example, it can be used if your project generates a password the 1st time and

docs/creating.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,4 @@ Copier includes:
9999
- It contains the current commit hash from the template in
100100
`{{ _copier_conf.vcs_ref_hash }}`.
101101
- Contains Operating System-specific directory separator under `sep` key.
102+
- It also contains the current `operation` (`copy` | `recopy` | `update`).

0 commit comments

Comments
 (0)