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 e0cac30
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,18 @@ to know available options.

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

When you define this parameter in `copier.yml`, it will **replace** the default
Expand Down Expand Up @@ -1316,6 +1328,8 @@ configuring `secret: true` in the [advanced prompt format][advanced-prompt-forma
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

For example, it can be used if your project generates a password the 1st time and
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 e0cac30

Please sign in to comment.