113 Commits

Author SHA1 Message Date
Ruslan
1b4bbb7148
docs: Improve documentation for tasks (#2036)
Mention that they run in subprocesses.

Fixes #2035.
2025-03-13 16:52:51 +01:00
Chris Brown
6a6db81b95
docs: fix typo in external data example 2025-03-12 06:40:19 +01:00
jeanluc
55d31e01c2
feat: Add _copier_operation variable (#1733)
* Makes `exclude` configuration templatable.
* Adds a `_copier_operation` variable to the rendering contexts for `exclude` and `tasks`, representing the current operation - either `copy`~~, `recopy`~~ or `update`.

This was proposed here: https://github.com/copier-org/copier/issues/1718#issuecomment-2282643624
2025-03-09 20:37:12 +00:00
autofix-ci[bot]
3ae6b78be3 style: autoformat with pre-commit 2025-02-16 08:09:11 +00:00
Jairo Llopis
25bc06d01d feat(external_data): load data from other YAML files
When composing templates, it's often needed to be able to load answers from other templates that you know are usually combined with yours. Or any other kind of external data.

@moduon MT-8282
2025-02-16 08:00:21 +00:00
Axel H.
71358ed397 feat(settings): allow to define some trusted repositories or prefixes 2025-01-29 19:46:06 +01:00
Francesco Calcavecchia
ec11ae28f0
docs: Mention uv tool as an alterative to pipx (#1924)
Co-authored-by: Francesco Calcavecchia <f18771@eon.com>
2025-01-14 14:07:04 +00:00
Sigurd Spieckermann
b5ef194328 feat: add support for dynamic choices 2024-10-18 19:41:34 +01:00
jeanluc
5ac93ee199
fix(updating): do not recreate deleted paths on update (#1719)
Previously, paths that matched a pattern in `skip_if_exists` and that were deleted in the generated project were recreated during each update. This was expected, because the file now didn't exist, and thus it's considered new. However, it might be surprising to some, so docs are updated and a test now makes that an officially supported use case.

For the rest of files, they shouldn't be recreated, even if the template changed. A user that deletes the file is kind of expressing their will to ignore that file from now on. To recover it, they can just recopy the template.

BREAKING CHANGE: If you delete a file in your subproject, it will not be recreated if it changes in the template and you update the subproject. Recopy if you need it back.
2024-08-17 08:44:09 +02:00
Adrian Freund
d6f226f2b3
feat: add simpler migrations configuration syntax (#1510) 2024-05-15 11:19:11 +02:00
Axel H
4ca2e35ff1
feat(tasks): add support for skipping tasks (#1561)
Co-authored-by: Timothée Mazzucotelli <dev@pawamoy.fr>
Co-authored-by: Sigurd Spieckermann <2206639+sisp@users.noreply.github.com>
2024-04-04 17:35:16 +02:00
Sigurd Spieckermann
53aab1f335 docs: prefer "questionnaire" over "questionary" 2023-12-01 08:54:17 +00:00
Axel H
99bdd11b68 feat(choices): support questionary checkbox for multiple choices using multiselect: true.
Fixes #218
2023-10-30 18:29:55 +00:00
Sigurd Spieckermann
59b8d6d8b0 docs: fix spelling/punctuation/terminology 2023-09-30 19:56:05 +02:00
mspiegel31
61cbe798a7
feat: allow overriding data file with CLI arguments (#1332)
Users should be able to pass CLI data arguments and use a `--data-file` at the same time.  Let's just take inspiration from the [helm values file](https://helm.sh/docs/chart_template_guide/values_files/) and give highest priority to data values passed at the command line.
2023-09-29 12:28:37 +01:00
Jannis Mainczyk
74769bc439
docs: improve link text formatting (#1344) 2023-09-26 16:58:20 +02:00
Sigurd Spieckermann
32746bd2a5 fix(cli): use return code 4 for unsafe template error
BREAKING CHANGE: Changes the return code for unsafe template error from
2 to 4 to avoid return code collision with Plumbum's `SwitchError` type
errors which use return code 2.
2023-09-25 10:26:55 +01:00
mspiegel31
a674e64a42
feat(cli): read answers from yaml file (#1325)
Co-authored-by: Sigurd Spieckermann <2206639+sisp@users.noreply.github.com>
2023-09-20 07:12:04 +02:00
Jairo Llopis
ddafdee3ce
docs: placeholders are always strings
Fixes https://github.com/copier-org/copier/issues/1327
2023-09-13 07:42:14 +01:00
Sigurd Spieckermann
97371493e7 docs: unify terminology 2023-09-08 10:28:19 +02:00
Jairo Llopis
448455239f
docs: tell the world about the templated siblings feature
Closes https://github.com/copier-org/copier/issues/1238
2023-09-07 15:30:49 +01:00
Sigurd Spieckermann
d8a667a462 docs: update outdated copier update --force examples 2023-08-28 13:57:16 +02:00
Sigurd Spieckermann
00e51bd94c
feat: add support for pre-update and post-update messages (#1288)
* feat: add support for pre-update and post-update messages

* test: use verbose regex syntax
2023-08-25 10:25:08 +01:00
Sigurd Spieckermann
a75066e34c docs: use autorefs for section references 2023-08-05 20:33:57 +02:00
Sigurd Spieckermann
1031601332 docs: use relative path to Markdown file for page linking 2023-07-19 13:48:49 +02:00
Sigurd Spieckermann
dc94486047 feat: add support for pre-copy and post-copy messages 2023-07-19 13:13:00 +02:00
Sigurd Spieckermann
9218e22807 fix: require default value for secret question 2023-07-19 05:53:26 +01:00
Sigurd Spieckermann
1e81fd5eca
feat: add support for computed values via skipped questions (#1220)
* feat: add support for computed values via skipped questions

* docs: apply review suggestions

Co-authored-by: Jairo Llopis <973709+yajo@users.noreply.github.com>

* docs: update inline comments

* docs: fix formatting

---------

Co-authored-by: Jairo Llopis <973709+yajo@users.noreply.github.com>
2023-07-08 10:36:21 +00:00
Jairo Llopis
aaf6cf3843
feat: add --trust as a less scary alternative to --UNSAFE (#1179)
See rationale in https://github.com/copier-org/copier/issues/1137#issuecomment-1579304713.

Co-authored-by: Sigurd Spieckermann <2206639+sisp@users.noreply.github.com>
2023-06-28 21:17:32 +02:00
Sigurd Spieckermann
1b351bc856 docs: update CLI usage examples to conform with v8
All CLI calls must use a subcommand as the first argument and all flags
must come after the subcommand. See #1143.
2023-06-15 17:17:05 +01:00
Sigurd Spieckermann
4cfe6f63dc feat: add OS identifier to render context 2023-06-14 16:19:40 +01:00
Sigurd Spieckermann
83f44cb4b6
feat: disable unsafe features by default and add --UNSAFE switch (#1171)
I've disabled the use of unsafe features (Jinja extensions, migrations, and tasks) by default and added a new CLI switch `--UNSAFE` which enables them. Templates that don't use unsafe features are unaffected by this change. But Copier will raise an error for templates that do use unsafe features unless the `--UNSAFE` flag is passed.

I've not added an interactive prompt that asks for consent for using unsafe features because I think it's not clear how to distinguish between interactive prompting and raising an error when `--UNSAFE` is not passed. For this, I think Copier would need a switch that clearly states whether interactive or non-interactive mode is desired. Currently, `--defaults` implies this for questions.

Fixes https://github.com/copier-org/copier/issues/1137

BREAKING CHANGE: Copier raises an error when a template uses unsafe features unless the `--UNSAFE` switch is passed
2023-06-01 18:22:40 +00:00
Jairo Llopis
070527e9b7 docs: clarify new update and overwrite behaviors 2023-05-30 07:34:22 +01:00
Sigurd Spieckermann
6e3a11ee2a docs: add reference to jinja2-jsonschema extension 2023-05-18 15:55:54 +01:00
Jairo Llopis
2c5ff9e9b7 refactor(update): default to inline markers and 3 lines of context
Now that the inline mode is out of experimental, it turns out to provide a better default behavior than the good old rej mode. Mostly when context is increased to 3 lines or more.

BREAKING CHANGE: The default update conflict mode is now `inline` instead of `rej`.

BREAKING CHANGE: By default, updates now consider 3 lines of context instead of just 1.
2023-05-17 11:56:13 +01:00
Sigurd Spieckermann
f6f37ab4fb
feat: support conditional choices (#1010)
Choices can now be validated with a custom inline jinja template.

Disabled choices won't be selectable, and they display a message telling why.
2023-05-04 09:13:18 +01:00
Jairo Llopis
09cc9953d1
docs: clarify what's invoke
Fix https://github.com/copier-org/copier/issues/1095.
2023-04-19 17:42:48 +01:00
Jairo Llopis
1709d677ee feat: customizable update accuracy
Until today, the updatediff algorithm always used just 1 line of context when detecting conflicts. This was because:

- Solving conflicts wasn't very ergonomic with those `.rej` files around.
- More lines meant too many conflicts usually.

However, it made the diff detection less accurate.

With this change, we allow the users to configure that algorithm. Since they have now the `--context inline` option, more conflicts isn't so much of a problem.

@moduon MT-2638
2023-04-17 12:59:28 +01:00
Sigurd Spieckermann
c0e356bf28 docs(configuring): fix typo 2023-04-17 12:56:27 +01:00
Nils de Bruin
4ecd0ce6c6 Update configuring.md
Changed ' to " as the statement dit not work
2023-04-17 12:53:08 +01:00
Sigurd Spieckermann
065d6ba1d0
fix: require answer for questions without default value (#958)
When questions didn't have a default answer, the interactive behavior was confusing.

Fixes https://github.com/copier-org/copier/issues/355.

BREAKING CHANGE: All default answers must be explicit now.
2023-04-07 08:09:27 +01:00
Adrian Freund
0f610be801
feat: support preserving symlinks when copying templates (#938)
* feat: Preserve symlinks when copying templates

* test: Add tests for symlink copying
2023-04-07 08:03:17 +01:00
Sigurd Spieckermann
266139bff4
feat: allow imports in inline templates (#986)
* feat: import Jinja templates/macros relative to template root

* feat: add `joinpath()` function to Jinja globals

* fix: use POSIX paths for Jinja imports/includes

* docs: fix `copier.yml` examples
2023-04-02 15:37:40 +00:00
Sigurd Spieckermann
474be856c1
docs: use tree fence for filesystem trees (#998)
* docs: use tree fence for filesystem trees

* docs: remove dashed lines in filesystem tree
2023-02-25 07:23:14 +00:00
Sigurd Spieckermann
c9e9c100ec fix(cli): use --conflict flag only in copier update subcommand 2023-02-21 21:21:01 +00:00
Sigurd Spieckermann
881a27e48a docs: fix filesystem tree 2023-02-20 19:45:19 +00:00
Sigurd Spieckermann
6c02cb0a41
feat: exclude nothing by default when using subdirectory 2023-02-02 11:23:56 +00:00
Raphael Krupinski
20a13b98f4
feat: add native OS directory separator variable in _copier_conf.sep to allow generating dynamic directory structures
* feat(Worker): make sure the parent directory of the target file exists before writing to it
* feat(_copier_conf): add directory separator (os.sep) to _copier_conf

Fix #692
2023-01-27 12:11:11 +00:00
Sigurd Spieckermann
5685c0cab4 docs: update note on Jinja defaults for Copier 7+ 2023-01-10 09:19:24 +00:00
Xuan Hu
a1c882e0ba docs: No redundant empty lines for _copier_answers.
Signed-off-by: Xuan Hu <i@huxuan.org>
2022-12-20 11:28:10 +00:00