Skip to content

Commit

Permalink
Document _copier_conf.operation
Browse files Browse the repository at this point in the history
  • Loading branch information
lkubb committed Aug 17, 2024
1 parent f010d84 commit 54fc0b7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,17 @@ to know available options.
[Patterns][patterns-syntax] for files/folders that must not be copied.

The CLI option can be passed several times to add several patterns.
Each pattern can be templated using Jinja.

!!! example

Templating `exclude` patterns using `_copier_conf.operation` allows to have files
that are rendered once during `copy`, but are never updated:

```yaml
_exclude:
- '{%- if _copier_conf.operation == "update" -%}src/*_example.py{%- endif %}'
```

!!! info

Expand Down Expand Up @@ -1315,6 +1326,7 @@ configuring `secret: true` in the [advanced prompt format][advanced-prompt-forma
[Patterns][patterns-syntax] for files/folders that must be skipped only if they already
exist, but always be present. If they do not exist in a project during an `update`
operation, they will be recreated.
Each pattern can be templated using Jinja.

!!! example

Expand Down
1 change: 1 addition & 0 deletions docs/creating.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,4 @@ Copier includes:
- It contains the current commit hash from the template in
`{{ _copier_conf.vcs_ref_hash }}`.
- Contains Operating System-specific directory separator under `sep` key.
- It also contains the current `operation` (`copy` | `recopy` | `update`).

0 comments on commit 54fc0b7

Please sign in to comment.