From 00d17badf87ac08aaca397e86758ab2fd51ca0fb Mon Sep 17 00:00:00 2001 From: gwen Date: Thu, 16 Apr 2026 11:47:06 +0200 Subject: [PATCH] types 80 --- docs/index.rst | 12 ++++---- docs/tutorial/customtype.rst | 58 ++++++++++++++++++++++++++++++++---- 2 files changed, 59 insertions(+), 11 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 1edff4bf0..03cc37d08 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -19,12 +19,12 @@ Rougail 7 tutorial/tutorial.rst:546: WARNING: term not in glossary: 'leader' 8 tutorial/tutorial.rst:547: WARNING: term not in glossary: 'follower' 9 variable.rst:38: WARNING: label non défini: 'convention on variable names' - 10 variable.rst:137: WARNING: term not in glossary: 'leading' - 11 variable.rst:154: WARNING: term not in glossary: 'required' - 12 variable.rst:156: WARNING: term not in glossary: 'leader' - 13 variable.rst:156: WARNING: term not in glossary: 'follower' - 14 variable.rst:186: WARNING: term not in glossary: 'multiple' - 15 variable.rst:186: WARNING: term not in glossary: 'multiple' + 10 variable.rst:137: WARNING: term not in glossary: 'leading' + 11 variable.rst:154: WARNING: term not in glossary: 'required' + 12 variable.rst:156: WARNING: term not in glossary: 'leader' + 13 variable.rst:156: WARNING: term not in glossary: 'follower' + 14 variable.rst:186: WARNING: term not in glossary: 'multiple' + 15 variable.rst:186: WARNING: term not in glossary: 'multiple' .. image:: images/logo.png diff --git a/docs/tutorial/customtype.rst b/docs/tutorial/customtype.rst index c4072cf10..4ccd4d8cc 100644 --- a/docs/tutorial/customtype.rst +++ b/docs/tutorial/customtype.rst @@ -32,11 +32,11 @@ This feature is essential for having a truly adaptable tool. .. note:: It is actually possible to add types, but that involves adding predefined types to the :term:`tiramisu` underlying consistency library itself, - and that’s a different matter altogether. There is a simpler way to achieve this: the Rougail type definition. + and that’s a different matter altogether. There is a simpler way to achieve this with the Rougail type definition feature. It is possible in Rougail to create custom types in a very simple way, it is much like defining families. -Now our folder structure will be expanded a bit: +Our folder structure will be expanded a bit: .. raw:: html :url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_080/tree.html @@ -120,15 +120,15 @@ It's perfectly natural in the rougail style. Now in the `address` family it is not necessary to specify the `domainname` type nor the `allow_ip` parameter: .. code-block:: yaml - :caption: We can omit this now due to the type definition + :caption: We can omit these settings now due to the type definition description: HTTP address type: domainname params: allow_ip: true -But if we use our new type we need to declare it to Rougail in order to make it available. -The Rougail CLI has a `--types` type declaration command line option for this purpose. +But in order to use our new type we need to declare it to Rougail otherwise the new type is not available. +The Rougail CLI has the `--types` type declaration command line option for this purpose. Let's launch the rougail CLI with this command line parameter: .. raw:: html @@ -145,6 +145,54 @@ We want the same behavior as usual. The type definition adds nothing to the structural logic. It's just a very convenient way to save time when writing structure files. +.. FIXME Ici nous avons juste changé la valeur des deux variables + +.. type-along:: kinematics of setting the `address` value + +Let's take the time to explain how the value of the variable `manual.http_proxy.address` is determined using the type definition. + +The :file:`10-manual.yml` defines the :file:`manual.https_proxy` family +which is defined with the help of the `proxy` type: + +.. code-block:: yaml + + http_proxy: + description: HTTP Proxy + type: proxy + +In the :file:`types/proxy/00_type.yml` file we have the `proxy` type definition and its default value setting: + +.. code-block:: yaml + + default: + variable: __.http_proxy.address + +This default value setting point to the `http_proxy.address` value in the :file:`firefox/10-manual.yml` structure file: + +.. code-block:: yaml + + address: + default: null + +Which is `null` by default but in the :file:`config/01/config.yml` user data file we have the `http.proxy.net` value set: + +.. code-block:: yaml + + manual: + http_proxy: + address: http.proxy.net + +In the CLI standard output we can see that the `http_proxy.address` variable value is +finally set by the user data file: + +:: + + ┗━━ 📂 manual (Manual proxy configuration) + ┣━━ 📂 http_proxy (HTTP Proxy) + ┃ ┣━━ 📓 address (Proxy address): http.proxy.net ◀ loaded from the YAML + ┃ ┃ file "config/01/config.yml" + + HTTPS and SOCKS Proxy -----------------------