missign rougail-tutorial tags

This commit is contained in:
gwen 2024-10-28 15:29:11 +01:00
parent c2111fe581
commit eda0632809
2 changed files with 104 additions and 22 deletions

View file

@ -71,13 +71,18 @@ Before getting started with Rougail we need to learn the specifics of the YAML d
Here is an empty rougail dictionary YAML file
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_001/firefox/00-proxy.yml
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_000/firefox/00-proxy.yml
:linenos:
:language: yaml
:caption: An empty rougail dictionnary file. It's a YAML format.
:name: RougailDictionaryEmptyFile
:download:`source file <https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_010/firefox/00-proxy.yml>`
..
---
version: 1.1
:download:`source file <https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_000/firefox/00-proxy.yml>`
You can see that there is just a `version` specification.
@ -100,34 +105,48 @@ The variables
Here is a :term:`structure file <dictionary>` example with a variable into it:
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_003/firefox/00-proxy.yml
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_010/firefox/00-proxy.yml
:linenos:
:language: yaml
:caption: A rougail dictionnary file with a variable named `proxy_mode`. It's the Rougail YAML dictionary format.
:name: RougailDictionaryFirstVariable
:download:`source file <https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_003/firefox/00-proxy.yml>`
..
---
proxy_mode:
:download:`source file <https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_010/firefox/00-proxy.yml>`
Here we declare a **variable** named `proxy_mode` without a default value.
A variable can be defined with no default value at all.
Here is the same variable with a description label:
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_004/firefox/00-proxy.yml
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_011/firefox/00-proxy.yml
:linenos:
:language: yaml
:caption: A rougail dictionnary file with a variable named `proxy_mode`, with a description.
:name: RougailDictionaryFirstVariableDescription
..
---
proxy_mode:
description: Configure Proxy Access to the Internet
The same with a default value:
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_005/firefox/00-proxy.yml
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_012/firefox/00-proxy.yml
:linenos:
:language: yaml
:caption: A rougail dictionnary file with a variable named `proxy_mode`, with a default value.
:name: RougailDictionaryFirstVariableDefault
..
---
proxy_mode:
description: Configure Proxy Access to the Internet
default: No proxy
variable
A variable is a declaration unit that represents a business domain metaphor,

View file

@ -83,11 +83,15 @@ So, if :
- there is no default value set in the structure file,
- no value is set in the value file:
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_004/firefox/00-proxy.yml
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_010/firefox/00-proxy.yml
:linenos:
:language: yaml
:caption: The :file:`config/01/config.yaml` rougail dictionnary file, with no default value set.
:name: RougailDictionaryNoDefaultUseCase
:caption: The :file:`struct/config.yaml` rougail structure file, with no default value set.
:name: RougailDictionaryNoDefault
..
---
proxy_mode:
In this situation there are no default value set. The rougail CLI will output an error :
@ -97,8 +101,15 @@ In this situation there are no default value set. The rougail CLI will output an
foo@bar:~$ rougail -v 1.1 -m firefox -u file -ff config/01/config.yaml
.. raw:: html
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_003/config/01/output_ro.html
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_010/config/01/output_ro.html
..
<pre>🛑 ERRORS
<span style="color: #ff0000">┣━━ </span>The following variables are mandatory but have no value:
<span style="color: #ff0000">┗━━ </span> - proxy_mode
</pre>
.. important:: Once defined, an option configuration :term:`value` is :term:`mandatory`.
Rougail waits for a value to be set, that's why.
@ -107,17 +118,54 @@ Rougail waits for a value to be set, that's why.
Type inference
-----------------
By default, rougail infers a `string` type for the `proxy_mode` configuration option variable type.
If the operator sets an option value with the `string` type, like this:
By default, rougail infers a `string` type for the `proxy_mode` configuration option variable type as defined
in the structure file.
.
If the operator sets an option value for example with the `number` type, like this:
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_003/config/05/config.yaml
.. code-block:: yaml
---
example_var:
description: Configure Proxy Access to the Internet
type: number
Then rougail will expect a `int` or a `float` as a value for the `example_var` variable.
In our firefox use case, the real type of the `proxy_mode` variable is a `choice` type:
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_013/config/05/config.yaml
:linenos:
:language: yaml
:caption: The :file:`config/05/config.yaml` rougail dictionnary file, with no default value set.
:name: RougailDictionaryNoDefaultUseCaseIntOptionValue
:caption: The :file:`config/05/config.yaml` rougail dictionnary file, with a default value set.
:name: RougailDictionaryChoiceTypeWitheDefault
..
---
proxy_mode:
description: Configure Proxy Access to the Internet
type: choice
choices:
- No proxy
- Auto-detect proxy settings for this network
- Use system proxy settings
- Manual proxy configuration
- Automatic proxy configuration URL
default: No proxy
.. raw:: html
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_003/config/05/output_ro.html
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_013/config/01/output_ro.html
..
<pre>╭────────────────────────── Caption ──────────────────────────╮
│ Variable <span style="color: #ffd700">Default value</span> │
│ <span style="color: #5c5cff">Undocumented variable</span> Modified value │
│ <span style="color: #ff0000">Undocumented but modified variable</span> (<span style="color: #00aa00">Original default value</span>) │
│ <span style="color: #ffaf00">Unmodifiable variable</span> │
╰─────────────────────────────────────────────────────────────╯
Variables:
<span style="color: #5c5cff">┗━━ </span>📓 proxy_mode: <span style="color: #ffd700">No proxy</span>
</pre>
.. keypoints:: Key points progress
@ -126,18 +174,33 @@ If the operator sets an option value with the `string` type, like this:
- :term:`structure file <dictionary>`: structure description file
- :term:`variable`: an option's name which has a value
- a variable's description
- a variable's type
- a variable's default value
- the :term:`integrator` and :term:`operator` roles
- a mandatory option value
- a mandatory value
To sum up, we have arrived here
To sum up, we have arrived at this point in writing the structure file:
**Structure description file**
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_005/firefox/00-proxy.yml
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_013/firefox/00-proxy.yml
:linenos:
:language: yaml
:caption: A rougail dictionnary file with a variable named `proxy_mode`, with a default value.
:name: RougailDictionaryDefaultVariabletUseCase
..
.. raw:: text
---
proxy_mode:
description: Configure Proxy Access to the Internet
type: choice
choices:
- No proxy
- Auto-detect proxy settings for this network
- Use system proxy settings
- Manual proxy configuration
- Automatic proxy configuration URL
default: No proxy