default value in the tutorial

This commit is contained in:
gwen 2025-02-04 16:38:07 +01:00
parent 543d54144b
commit 55bda5cd8c
2 changed files with 56 additions and 34 deletions

View file

@ -89,7 +89,7 @@ You can see that there is just a `version` specification.
.. code-block:: bash
foo@bar:~$ rougail -v 1.1
rougail -v 1.1
The variables
-----------------

View file

@ -13,6 +13,10 @@ Preliminaries
We assume that Rougail's library is :ref:`already installed <installation>` on your computer (or in a virtual environment).
.. type-along:: an empty dictionary
An empty structure description file
.. exercise:: The folder structure
Here is the tree structure we want to have::
@ -21,32 +25,9 @@ Preliminaries
├── firefox
   │   ├── dictionary.yml
- Let's make a :file:`workplace` directory, with a :file:`dict` subfolder.
- First, we wil make a :term:`dictionary`, so let's make the :file:`dictionary.yml` file
which is located in the :file:`firefox` subfolder.
- Then we will run this command
.. code-block:: shell
foo@bar:~$ rougail -v 1.1 -m firefox/
which actually outputs an error:
.. raw:: html
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_010/config/01/output_ro.html
..
🛑 ERRORS
┣━━ The following variables are mandatory but have no value:
┗━━ - proxy_mode
Because this variable is :term:`mandatory` and needs to be set.
FIXME : ce dico doit être mis en haut
.. type-along:: a default dictionary
An empty structure description file
- Let's make a :file:`workplace` directory, with a :file:`firefox` subfolder.
- First, we wil make a :term:`dictionary`, so let's create a :file:`dictionary.yml` file
located in the :file:`firefox` subfolder.
The dictionary
----------------
@ -55,16 +36,17 @@ This is an empty Rougail dictionnary
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_000/firefox/00-proxy.yml
:language: yaml
:caption: An empty rougail dictionnary file with only the version
:caption: An empty rougail dictionnary file with the version number only
:name: RougailDictionaryEmptyFile
..
---
version: 1.1
.. type-along:: a dictionary with a variable
.. type-along:: a first variable
Let's put a variable in the Rougail :term:`structure description file <dictionary>`
Let's define a Rougail :term:`structure description file <dictionary>` with something defined in it.
Defining a variable and its default value
----------------------------------------------
@ -80,15 +62,55 @@ This is a first Rougail variable in a Rougail dictionnary.
---
proxy_mode:
This is a Rougail variable in a Rougail dictionnary, we define a variable with a description of it.
- Then we will run this command
.. code-block:: shell
rougail -v 1.1 -m firefox/
which actually outputs an error:
.. raw:: html
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_010/config/01/output_ro.html
..
🛑 ERRORS
┣━━ The following variables are mandatory but have no value:
┗━━ - proxy_mode
Because this variable is :term:`mandatory` and needs to be set **but** there's no value yet.
:ref:`Here is a Rougail variable with a description <RougailDictionaryFirstVariableDescription>`
Here we juste add a variable's description, which is a good practice.
- define a variable with a description and a default value
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_011/firefox/00-proxy.yml
:language: yaml
:caption: A Rougail dictionnary file with a variable and a description
:name: RougailDictionaryFirstVariableDescription
..
---
proxy_mode:
description: Configure Proxy Access to the Internet
We need a **default value**.
.. glossary::
default values
A default value is a variable value that is predefined, that is, this value is placed
right in the structure file.
So let's define a variable with a description -- **and a default value**
FIXME GWEN
:ref:`Here is a Rougail variable with a default value <RougailDictionaryFirstVariableDefault>`
The integrator role
----------------------
@ -157,7 +179,7 @@ Then the rougail CLI will output an error :
.. code-block:: shell
:caption: A rougail Command Line Utility call with the :file:`config/01/config.yaml` Rougail dictionnary file
foo@bar:~$ rougail -v 1.1 -m firefox -u file -ff config/01/config.yaml
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_010/config/01/output_ro.html