choice ok

This commit is contained in:
gwen 2025-11-27 19:15:02 +01:00
parent 9ca4f31986
commit f1af25d11a
2 changed files with 7 additions and 5 deletions

View file

@ -109,9 +109,11 @@ We have this output:
As we set the `proxy_mode` variable from a user data file, As we set the `proxy_mode` variable from a user data file,
we now have specified a value which is **not** a default value, and we now have specified a value which is **not** a default value, and
the output of the rougail CLI explicitly shows that a user data value has been entered. the output of the rougail CLI explicitly shows that a user data value has been entered,
it shows which user data file this value comes from, and it also indicates
what the default value is for information purposes.
.. type-along:: The constraints that come with the `choice` property .. type-along:: The constraints that come with the choices
The `proxy_mode` variable's possible values is *constrained*. The `proxy_mode` variable's possible values is *constrained*.
@ -125,7 +127,7 @@ We have the list of the possible (authorized) values:
.. questions:: Question .. questions:: Question
What happens if I set a value that is not available in the `choice` list? What happens if I set a value that is not available in the choices?
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_010/config/04/config.yml .. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_010/config/04/config.yml
:linenos: :linenos:
@ -184,7 +186,7 @@ Then we have an `error` output instead of a `warning` output:
Indeed, in the Firefox configuration, it is possible to define several configuration modes, Indeed, in the Firefox configuration, it is possible to define several configuration modes,
from no proxy at all to different kind of automatic or manual configuration modes. from no proxy at all to different kind of automatic or manual configuration modes.
The `choice` parameter, that is the list of available values for a variable, can help us to handle this situation. The choices, the list of available values for a variable, can help us to handle this situation.
**Progress** **Progress**

View file

@ -342,7 +342,7 @@ which gives us this output:
<span style="color: #5c5cff">┗━━ </span>📓 proxy_mode: No proxy ◀ loaded from the YAML file "config/02/config.yml" <span style="color: #5c5cff">┗━━ </span>📓 proxy_mode: No proxy ◀ loaded from the YAML file "config/02/config.yml"
</pre> </pre>
Now the `proxy_mode`'s new `No proxy` value is the same as the default value but we see that the value Now the `proxy_mode`'s new `No proxy` value is the same as the default value but we see in the rougail CLI output that the value
comes from the :file:`config/02/config.yml` user data file. From now on this `proxy_mode` variable's value comes from the :file:`config/02/config.yml` user data file. From now on this `proxy_mode` variable's value
is a user data value and not a default value (even if it's actually the same value). is a user data value and not a default value (even if it's actually the same value).