[tutorial 006] A variable with type choice (config and doc)

This commit is contained in:
egarette@silique.fr 2024-10-23 10:58:14 +02:00
parent 982beb924d
commit 2022c20632
3 changed files with 28 additions and 13 deletions

View file

@ -1,9 +1,9 @@
- [Summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/branch/1.1/README.md) - [Summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/branch/1.1/README.md)
- [[tutorial 004] The variable description](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_004/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_004~1..v1.1_004)) - [[tutorial 005] A default value](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_005/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_005~1..v1.1_005))
# [tutorial 005] A default value # [tutorial 006] A variable with type choice
[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_005~1..v1.1_005) [View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_006~1..v1.1_006)
## Screenshot ## Screenshot
@ -22,6 +22,13 @@
--- ---
proxy_mode: proxy_mode:
description: Configure Proxy Access to the Internet 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 default: No proxy
``` ```
@ -32,9 +39,9 @@ foo@bar:~$ rougail -v 1.1 -m firefox/ -o doc -do github
``` ```
### Variables ### Variables
| Variable                                                                                        | Description                                                                                     | | Variable                                                                                                                                                                                             | Description                                                                                                                                                                                          |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **proxy_mode**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | Configure Proxy Access to the Internet.<br/>**Default**: No proxy | | **proxy_mode**<br/>[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | Configure Proxy Access to the Internet.<br/>**Choices**: <br/>- No proxy ← (default)<br/>- Auto-detect proxy settings for this network<br/>- Use system proxy settings<br/>- Manual proxy configuration<br/>- Automatic proxy configuration URL |
## User data ## User data
@ -125,14 +132,17 @@ proxy_mode: foo
```console ```console
foo@bar:~$ rougail -v 1.1 -m firefox/ -u file -ff config/04/config.yaml foo@bar:~$ rougail -v 1.1 -m firefox/ -u file -ff config/04/config.yaml
``` ```
<pre>╭────────────────────────── Caption ──────────────────────────╮ <pre>🛑 ERRORS
<span style="color: #ff0000">┗━━ </span>"foo" is an invalid choice for "proxy_mode (Configure Proxy Access to the Internet)", only "Auto-detect proxy settings for this network", "Automatic proxy configuration URL", "Manual proxy configuration", "No
<span style="color: #ff0000"> </span>proxy" and "Use system proxy settings" are allowed
╭────────────────────────── Caption ──────────────────────────╮
│ Variable <span style="color: #ffd700">Default value</span> │ Variable <span style="color: #ffd700">Default value</span>
<span style="color: #5c5cff">Undocumented variable</span> Modified value │ <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: #ff0000">Undocumented but modified variable</span> (<span style="color: #00aa00">Original default value</span>) │
<span style="color: #ffaf00">Unmodifiable variable</span> <span style="color: #ffaf00">Unmodifiable variable</span>
╰─────────────────────────────────────────────────────────────╯ ╰─────────────────────────────────────────────────────────────╯
Variables: Variables:
<span style="color: #5c5cff">┗━━ </span>📓 proxy_mode: foo (<span style="color: #00aa00">No proxy</span>) <span style="color: #5c5cff">┗━━ </span>📓 proxy_mode: <span style="color: #ffd700">No proxy</span>
</pre> </pre>
### Example 5 ### Example 5
@ -150,7 +160,8 @@ proxy_mode: 1
foo@bar:~$ rougail -v 1.1 -m firefox/ -u file -ff config/05/config.yaml foo@bar:~$ rougail -v 1.1 -m firefox/ -u file -ff config/05/config.yaml
``` ```
<pre>🛑 ERRORS <pre>🛑 ERRORS
<span style="color: #ff0000">┗━━ </span>"1" is an invalid string for "proxy_mode (Configure Proxy Access to the Internet)" <span style="color: #ff0000">┗━━ </span>"1" is an invalid choice for "proxy_mode (Configure Proxy Access to the Internet)", only "Auto-detect proxy settings for this network", "Automatic proxy configuration URL", "Manual proxy configuration", "No
<span style="color: #ff0000"> </span>proxy" and "Use system proxy settings" are allowed
╭────────────────────────── Caption ──────────────────────────╮ ╭────────────────────────── Caption ──────────────────────────╮
│ Variable <span style="color: #ffd700">Default value</span> │ Variable <span style="color: #ffd700">Default value</span>
<span style="color: #5c5cff">Undocumented variable</span> Modified value │ <span style="color: #5c5cff">Undocumented variable</span> Modified value │
@ -162,4 +173,4 @@ Variables:
</pre> </pre>
- [[tutorial 006] A variable with type choice](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_006/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_006~1..v1.1_006)) - [[tutorial 007] Choice type is optional](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_007/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_007~1..v1.1_007))

View file

@ -1,9 +1,12 @@
<pre>╭────────────────────────── Caption ──────────────────────────╮ <pre>🛑 ERRORS
<span style="color: #ff0000">┗━━ </span>"foo" is an invalid choice for "proxy_mode (Configure Proxy Access to the Internet)", only "Auto-detect proxy settings for this network", "Automatic proxy configuration URL", "Manual proxy configuration", "No
<span style="color: #ff0000"> </span>proxy" and "Use system proxy settings" are allowed
╭────────────────────────── Caption ──────────────────────────╮
│ Variable <span style="color: #ffd700">Default value</span> │ Variable <span style="color: #ffd700">Default value</span>
<span style="color: #5c5cff">Undocumented variable</span> Modified value │ <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: #ff0000">Undocumented but modified variable</span> (<span style="color: #00aa00">Original default value</span>) │
<span style="color: #ffaf00">Unmodifiable variable</span> <span style="color: #ffaf00">Unmodifiable variable</span>
╰─────────────────────────────────────────────────────────────╯ ╰─────────────────────────────────────────────────────────────╯
Variables: Variables:
<span style="color: #5c5cff">┗━━ </span>📓 proxy_mode: foo (<span style="color: #00aa00">No proxy</span>) <span style="color: #5c5cff">┗━━ </span>📓 proxy_mode: <span style="color: #ffd700">No proxy</span>
</pre> </pre>

View file

@ -1,5 +1,6 @@
<pre>🛑 ERRORS <pre>🛑 ERRORS
<span style="color: #ff0000">┗━━ </span>"1" is an invalid string for "proxy_mode (Configure Proxy Access to the Internet)" <span style="color: #ff0000">┗━━ </span>"1" is an invalid choice for "proxy_mode (Configure Proxy Access to the Internet)", only "Auto-detect proxy settings for this network", "Automatic proxy configuration URL", "Manual proxy configuration", "No
<span style="color: #ff0000"> </span>proxy" and "Use system proxy settings" are allowed
╭────────────────────────── Caption ──────────────────────────╮ ╭────────────────────────── Caption ──────────────────────────╮
│ Variable <span style="color: #ffd700">Default value</span> │ Variable <span style="color: #ffd700">Default value</span>
<span style="color: #5c5cff">Undocumented variable</span> Modified value │ <span style="color: #5c5cff">Undocumented variable</span> Modified value │