Skip to content

Commit

Permalink
docs: rewrite the conditional files / directories example description. (
Browse files Browse the repository at this point in the history
#1437)

* docs: rewrite the conditional files / directories example description.

The example didn't match the description structure of the previous
example and it mentioned the pre_gen_project, when it should be
post_gen_project hook.

* docs: improve hooks example phrasing
  • Loading branch information
lyz-code committed Dec 26, 2020
1 parent 269ba42 commit 52dd185
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions docs/advanced/hooks.rst
Expand Up @@ -67,8 +67,9 @@ value of the ``cookiecutter.module_name`` template variable:
Example: Validating template variables
--------------------------------------

Here is an example of a script that validates a template variable
before generating the project, to be used as ``hooks/pre_gen_project.py``:
Here is an example of a pre-generate hook script, defined at
``hooks/pre_gen_project.py``, that validates a template variable before generating the
project:

.. code-block:: python
Expand All @@ -88,9 +89,10 @@ before generating the project, to be used as ``hooks/pre_gen_project.py``:
Example: Conditional files / directories
----------------------------------------
This is another example of ``hooks/pre_gen_project.py`` to demonstrate
how to use post-processing hooks to achieve conditional control of files,
directories.

Here is an example of a post-generate hook script, defined at
``hooks/post_gen_project.py``, on how to achieve conditional control of files and
directories after generating the project.

The script ensures that the directory structure is as expected by
removing unwanted files and directories:
Expand Down

0 comments on commit 52dd185

Please sign in to comment.