From 8cbb09b294097ee2dfdf362702154eae3a484cd5 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 4 Nov 2025 19:22:30 +0100 Subject: [PATCH] [tutorial v1.1_062)] A non mandatory variable (config and doc) --- README.md | 104 ++++++++++++++++++++++++++++----------- config/02/config.yaml | 6 +-- config/02/output_ro.html | 6 +-- config/03/config.yaml | 3 +- config/03/output_ro.html | 6 ++- config/04/config.yaml | 2 + config/04/output_ro.html | 9 ++++ config/05/config.yaml | 2 + config/05/output_ro.html | 9 ++++ 9 files changed, 105 insertions(+), 42 deletions(-) create mode 100644 config/04/config.yaml create mode 100644 config/04/output_ro.html create mode 100644 config/05/config.yaml create mode 100644 config/05/output_ro.html diff --git a/README.md b/README.md index 1087610a..ce664ca7 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ - [Summary](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/branch/1.1/README.md) -- [[tutorial v1.1_060] A variable with type "domainname", parameters type and disabled](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_060/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_060~1..v1.1_060)) +- [[tutorial v1.1_061] A variable with multiple value](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_061/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_061~1..v1.1_061)) -# [tutorial v1.1_061)] A variable with multiple value +# [tutorial v1.1_062)] A non mandatory variable -[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_061~1..v1.1_061) +[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_062~1..v1.1_062) ## Screenshot @@ -147,6 +147,7 @@ no_proxy: allow_without_dot: true allow_startswith_dot: true multi: true + mandatory: false disabled: variable: _.proxy_mode when: No proxy @@ -156,7 +157,7 @@ no_proxy: ### Let's generate the documentation ```console -foo@bar:~$ git switch --detach v1.1_061 +foo@bar:~$ git switch --detach v1.1_062 foo@bar:~$ rougail -m firefox/ -o doc -do github ``` | Variable                                                                                        | Description                                                                                     | @@ -204,22 +205,22 @@ This family builds families dynamically | **manual.*https*_proxy.port**
**manual.*socks*_proxy.port**
[`port`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` | *HTTPS* or *SOCKS* port.
**Validators**:
- well-known ports (1 to 1023) are allowed
- registred ports (1024 to 49151) are allowed
- private ports (greater than 49152) are allowed
**Default**: the value of the variable "manual.http_proxy.port" | | **manual.*https*_proxy.version**
**manual.*socks*_proxy.version**
[`choice`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` *`disabled`* | SOCKS host version used by proxy.
**Choices**:
- v4
- v5 **← (default)**
**Disabled**: when the identifier is "HTTPS" | -| Variable                                                                                                                             | Description                                                                                                                          | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **auto**
[`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` *`disabled`* | Automatic proxy configuration URL.
**Validator**: the domain name in web address can be only a hostname
**Disabled**: when the variable "proxy_mode" hasn't the value "Automatic proxy configuration URL" | -| **no_proxy**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` *`disabled`* `unique` `multiple` | Address for which proxy will be desactivated.
**Validators**:
- the domain name can starts by a dot
- the domain name can be a hostname
- the domain name can be an IP
- the domain name can be network in CIDR format
**Disabled**: when the variable "proxy_mode" has the value "No proxy" | +| Variable                                                                                                                 | Description                                                                                                              | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **auto**
[`web_address`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` *`disabled`* | Automatic proxy configuration URL.
**Validator**: the domain name in web address can be only a hostname
**Disabled**: when the variable "proxy_mode" hasn't the value "Automatic proxy configuration URL" | +| **no_proxy**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) *`disabled`* `unique` `multiple` | Address for which proxy will be desactivated.
**Validators**:
- the domain name can starts by a dot
- the domain name can be a hostname
- the domain name can be an IP
- the domain name can be network in CIDR format
**Disabled**: when the variable "proxy_mode" has the value "No proxy" | ### Let's generate the changelog ```console -foo@bar:~$ git switch --detach v1.1_061 +foo@bar:~$ git switch --detach v1.1_062 foo@bar:~$ rougail -m firefox/ -o doc --doc.contents changelog -do github ``` #### Modified variable -| Variable                                                                                                                                                   | Description                                                                                                                                                | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **no_proxy**
[`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` *`disabled`* `unique` `multiple` | Address for which proxy will be desactivated.
**Validators**:
- the domain name can starts by a dot
- the domain name can be a hostname
- the domain name can be an IP
- the domain name can be network in CIDR format
**Disabled**: when the variable "proxy_mode" has the value "No proxy" | +| Variable                                                                                                                                 | Description                                                                                                                              | +|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **no_proxy**
~~`mandatory`~~ [`domainname`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) *`disabled`* `unique` `multiple` | Address for which proxy will be desactivated.
**Validators**:
- the domain name can starts by a dot
- the domain name can be a hostname
- the domain name can be an IP
- the domain name can be network in CIDR format
**Disabled**: when the variable "proxy_mode" has the value "No proxy" | ## User datas @@ -236,7 +237,7 @@ foo@bar:~$ rougail -m firefox/ -o doc --doc.contents changelog -do github #### Output ```console -foo@bar:~$ git switch --detach v1.1_061 +foo@bar:~$ git switch --detach v1.1_062 foo@bar:~$ rougail -m firefox/ -u yaml -ff config/01/config.yaml ```
╭─────── Caption ────────╮
@@ -252,17 +253,13 @@ Variables:
 
 ```yml
 ---
-proxy_mode: Automatic proxy configuration URL
-auto: https://auto.proxy.net/wpad.dat
-no_proxy:
-  - example.net
-  - 192.168.1.0/24
+proxy_mode: No proxy
 
 ```
 #### Output
 
 ```console
-foo@bar:~$ git switch --detach v1.1_061
+foo@bar:~$ git switch --detach v1.1_062
 foo@bar:~$ rougail -m firefox/ -u yaml -ff config/02/config.yaml
 ```
 
╭────────────── Caption ───────────────╮
@@ -270,11 +267,7 @@ foo@bar:~$ rougail -m firefox/ -u yaml -ff config/02/config.yaml
 │          (⏳ Original default value) │
 ╰──────────────────────────────────────╯
 Variables:
-┣━━ 📓 Configure Proxy Access to the Internet: Automatic proxy configuration URL ◀ loaded from the YAML file "config/02/config.yaml" (⏳ No proxy)
-┣━━ 📓 Automatic proxy configuration URL: https://auto.proxy.net/wpad.dat ◀ loaded from the YAML file "config/02/config.yaml"
-┗━━ 📓 Address for which proxy will be desactivated:
-    ┣━━ example.net ◀ loaded from the YAML file "config/02/config.yaml"
-    ┗━━ 192.168.1.0/24 ◀ loaded from the YAML file "config/02/config.yaml"
+┗━━ 📓 Configure Proxy Access to the Internet: No proxy ◀ loaded from the YAML file "config/02/config.yaml" (⏳ No proxy)
 
### Example 3 @@ -283,20 +276,73 @@ Variables: ```yml --- -proxy_mode: Automatic proxy configuration URL -auto: https://auto.proxy.net/wpad.dat +proxy_mode: Manual proxy configuration ``` #### Output ```console -foo@bar:~$ git switch --detach v1.1_061 +foo@bar:~$ git switch --detach v1.1_062 foo@bar:~$ rougail -m firefox/ -u yaml -ff config/03/config.yaml ```
🛑 ERRORS
 ┗━━ The following variables are mandatory but have no value:
-    ┗━━ Address for which proxy will be desactivated
+    ┗━━ Manual proxy configuration
+        ┣━━ HTTP Proxy
+        ┗━━ HTTP address
+        ┗━━ SOCKS Proxy
+            ┗━━ SOCKS address
+
+### Example 4 + +#### config/04/config.yaml + + +```yml +--- +proxy_mode: foo + +``` +#### Output + +```console +foo@bar:~$ git switch --detach v1.1_062 +foo@bar:~$ rougail -m firefox/ -u yaml -ff config/04/config.yaml +``` +
🔔 WARNINGS
+┗━━ the value "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 proxy" and "Use system proxy settings" are allowed, it will be ignored when loading from the YAML file "config/04/config.yaml"
+╭─────── Caption ────────╮
+│ Variable Default value │
+╰────────────────────────╯
+Variables:
+┗━━ 📓 Configure Proxy Access to the Internet: No proxy
+
+### Example 5 + +#### config/05/config.yaml + + +```yml +--- +proxy_mode: 1 + +``` +#### Output + +```console +foo@bar:~$ git switch --detach v1.1_062 +foo@bar:~$ rougail -m firefox/ -u yaml -ff config/05/config.yaml +``` +
🔔 WARNINGS
+┗━━ the value "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 proxy" and "Use system proxy settings" are allowed, it will be ignored when loading from the YAML file "config/05/config.yaml"
+╭─────── Caption ────────╮
+│ Variable Default value │
+╰────────────────────────╯
+Variables:
+┗━━ 📓 Configure Proxy Access to the Internet: No proxy
 
-- [[tutorial v1.1_062] A non mandatory variable](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_062/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_062~1..v1.1_062)) +- [[tutorial v1.1_063] Examples](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_063/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_063~1..v1.1_063)) diff --git a/config/02/config.yaml b/config/02/config.yaml index ccba4c0f..d9144882 100644 --- a/config/02/config.yaml +++ b/config/02/config.yaml @@ -1,6 +1,2 @@ --- -proxy_mode: Automatic proxy configuration URL -auto: https://auto.proxy.net/wpad.dat -no_proxy: - - example.net - - 192.168.1.0/24 +proxy_mode: No proxy diff --git a/config/02/output_ro.html b/config/02/output_ro.html index 443430d0..b0153620 100644 --- a/config/02/output_ro.html +++ b/config/02/output_ro.html @@ -3,9 +3,5 @@ │ (⏳ Original default value) │ ╰──────────────────────────────────────╯ Variables: -┣━━ 📓 Configure Proxy Access to the Internet: Automatic proxy configuration URL ◀ loaded from the YAML file "config/02/config.yaml" (⏳ No proxy) -┣━━ 📓 Automatic proxy configuration URL: https://auto.proxy.net/wpad.dat ◀ loaded from the YAML file "config/02/config.yaml" -┗━━ 📓 Address for which proxy will be desactivated: - ┣━━ example.net ◀ loaded from the YAML file "config/02/config.yaml" - ┗━━ 192.168.1.0/24 ◀ loaded from the YAML file "config/02/config.yaml" +┗━━ 📓 Configure Proxy Access to the Internet: No proxy ◀ loaded from the YAML file "config/02/config.yaml" (⏳ No proxy)
diff --git a/config/03/config.yaml b/config/03/config.yaml index 307e175b..74edb225 100644 --- a/config/03/config.yaml +++ b/config/03/config.yaml @@ -1,3 +1,2 @@ --- -proxy_mode: Automatic proxy configuration URL -auto: https://auto.proxy.net/wpad.dat +proxy_mode: Manual proxy configuration diff --git a/config/03/output_ro.html b/config/03/output_ro.html index 5b93c3a0..a4d85106 100644 --- a/config/03/output_ro.html +++ b/config/03/output_ro.html @@ -1,4 +1,8 @@
🛑 ERRORS
 ┗━━ The following variables are mandatory but have no value:
-    ┗━━ Address for which proxy will be desactivated
+    ┗━━ Manual proxy configuration
+        ┣━━ HTTP Proxy
+        ┗━━ HTTP address
+        ┗━━ SOCKS Proxy
+            ┗━━ SOCKS address
 
diff --git a/config/04/config.yaml b/config/04/config.yaml new file mode 100644 index 00000000..e3fa25da --- /dev/null +++ b/config/04/config.yaml @@ -0,0 +1,2 @@ +--- +proxy_mode: foo diff --git a/config/04/output_ro.html b/config/04/output_ro.html new file mode 100644 index 00000000..3b735cce --- /dev/null +++ b/config/04/output_ro.html @@ -0,0 +1,9 @@ +
🔔 WARNINGS
+┗━━ the value "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 proxy" and "Use system proxy settings" are allowed, it will be ignored when loading from the YAML file "config/04/config.yaml"
+╭─────── Caption ────────╮
+│ Variable Default value │
+╰────────────────────────╯
+Variables:
+┗━━ 📓 Configure Proxy Access to the Internet: No proxy
+
diff --git a/config/05/config.yaml b/config/05/config.yaml new file mode 100644 index 00000000..bf6f64ca --- /dev/null +++ b/config/05/config.yaml @@ -0,0 +1,2 @@ +--- +proxy_mode: 1 diff --git a/config/05/output_ro.html b/config/05/output_ro.html new file mode 100644 index 00000000..21c747f4 --- /dev/null +++ b/config/05/output_ro.html @@ -0,0 +1,9 @@ +
🔔 WARNINGS
+┗━━ the value "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 proxy" and "Use system proxy settings" are allowed, it will be ignored when loading from the YAML file "config/05/config.yaml"
+╭─────── Caption ────────╮
+│ Variable Default value │
+╰────────────────────────╯
+Variables:
+┗━━ 📓 Configure Proxy Access to the Internet: No proxy
+