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 16, 2024
1 parent aa434c4 commit 031e199
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 @@ -1314,6 +1325,7 @@ configuring `secret: true` in the [advanced prompt format][advanced-prompt-forma

[Patterns][patterns-syntax] for files/folders that must be skipped if they already
exist.
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 031e199

Please sign in to comment.