[tutorial v1.1_001] Let’s add our first variable (config and doc)

This commit is contained in:
egarette@silique.fr 2026-01-08 20:21:55 +01:00
parent 03de775190
commit d0b7790788
14 changed files with 151 additions and 12 deletions

120
README.md
View file

@ -1,10 +1,11 @@
- [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 v1.1_000] Creating a structure file](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_000/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_000~1..v1.1_000))
# [tutorial v1.1_000] Creating a structure file # [tutorial v1.1_001] Lets add our first variable
[View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_000~1..v1.1_000) [View the diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_001~1..v1.1_001)
[Read the documentation](https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/preliminary.html#creating-a-structure-file) [Read the documentation](https://pedago.gwenaelremond.fr/bribes/rougail/tutorial/preliminary.html#let-s-add-our-first-variable)
## Screenshot ## Screenshot
@ -30,7 +31,7 @@ pip install rougail-cli rougail-output-exporter rougail-output-doc rougail-user-
Then switch to the tutorial page: Then switch to the tutorial page:
```shell ```shell
git switch --detach v1.1_000 git switch --detach v1.1_001
``` ```
## Structure ## Structure
@ -38,9 +39,9 @@ git switch --detach v1.1_000
<p> <p>
<a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_000/./">.</a><br/> <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_001/./">.</a><br/>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_000/./firefox/">firefox</a><br/> └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_001/./firefox/">firefox</a><br/>
    └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_000/./firefox/00-proxy.yml">00-proxy.yml</a><br/>     └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_001/./firefox/00-proxy.yml">00-proxy.yml</a><br/>
<br/><br/></p> <br/><br/></p>
Contents of the firefox/00-proxy.yml file Contents of the firefox/00-proxy.yml file
@ -49,10 +50,36 @@ Contents of the firefox/00-proxy.yml file
%YAML 1.2 %YAML 1.2
--- ---
version: 1.1 version: 1.1
proxy_mode:
... ...
``` ```
***
### Let's generate the documentation
```shell
rougail -m firefox/ -o doc
```
| Variable |
|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **<a id="proxy_mode" name="proxy_mode">proxy_mode</a>**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` |
***
### Let's generate the changelog
```shell
rougail -m firefox/ -o doc --doc.contents changelog
```
#### New variable
| Variable |
|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **<a id="proxy_mode" name="proxy_mode">proxy_mode</a>**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `mandatory` |
*** ***
## User datas ## User datas
@ -71,8 +98,85 @@ version: 1.1
```shell ```shell
rougail -m firefox/ -u yaml -yf config/01/config.yml rougail -m firefox/ -u yaml -yf config/01/config.yml
``` ```
> [!CAUTION]
>
> - proxy_mode: :stop_sign: <span style="color: #C23636">mandatory variable but has no value</span>
***
#### Output in read write mode
```shell
rougail -m firefox/ -u yaml -yf config/01/config.yml --cli.read_write
```
> [!NOTE]
>
> **Caption:**
> - Variable
> - <span style="color: #B8860B">Default value</span>
Variables:
- :notebook: proxy_mode: <span style="color: #B8860B">null</span>
***
### Example 2
#### config/02/config.yml
```yml
---
proxy_mode: No proxy
```
***
#### Output
```shell
rougail -m firefox/ -u yaml -yf config/02/config.yml
```
> [!NOTE]
>
> **Caption:**
> - Variable
> - <span style="color: #006400">Modified value</span>
Variables:
- :notebook: proxy_mode: <span style="color: #006400">No proxy</span> ← loaded from the YAML file "config/02/config.yml"
***
### Example 3
#### config/03/config.yml
```yml
---
proxy_mode: 1
```
***
#### Output
```shell
rougail -m firefox/ -u yaml -yf config/03/config.yml
```
> [!CAUTION]
>
> - proxy_mode
> - [#EFBF04]:bell: the value "1" is an invalid string, it's not a string, it will be ignored when loading from the YAML file "config/03/config.yml"[/#EFBF04]
> - [#C23636]:stop_sign: mandatory variable but has no value[/#C23636]
***
#### Output when invalid user data is an error
```shell
rougail -m firefox/ -u yaml -yf config/03/config.yml --cli.invalid_user_data_error
```
> [!CAUTION]
>
> - proxy_mode: :stop_sign: <span style="color: #C23636">the value "1" is an invalid string, it's not a string, it has been loading from the YAML file "config/03/config.yml"</span>
*** ***
- [[tutorial v1.1_001] Lets add our first variable](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_001/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_001~1..v1.1_001)) - [[tutorial v1.1_002] Describe the variable](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_002/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_002~1..v1.1_002))

1
config/01/cmd_rw.txt Normal file
View file

@ -0,0 +1 @@
rougail -m firefox/ -u yaml -yf config/01/config.yml --cli.read_write

View file

@ -1 +1,3 @@
<pre></pre> <pre><span style="font-weight: bold; color: #ff0000">🛑 Caution</span>
<span style="color: #ff0000">┗━━ </span>proxy_mode: <span style="color: #ff0000">🛑 mandatory variable but has no value</span>
</pre>

9
config/01/output_rw.html Normal file
View file

@ -0,0 +1,9 @@
<pre>&gt; [!NOTE]
&gt;
&gt; **Caption:**
&gt; - Variable
&gt; - &lt;span style="color: #B8860B"&gt;Default value&lt;/span&gt;
Variables:
- :notebook: proxy_mode: &lt;span style="color: #B8860B"&gt;null&lt;/span&gt;
</pre>

1
config/02/cmd_ro.txt Normal file
View file

@ -0,0 +1 @@
rougail -m firefox/ -u yaml -yf config/02/config.yml

2
config/02/config.yml Normal file
View file

@ -0,0 +1,2 @@
---
proxy_mode: No proxy

6
config/02/output_ro.html Normal file
View file

@ -0,0 +1,6 @@
<pre>╭──────── Caption ────────╮
│ Variable <span style="color: #00aa00">Modified value</span>
╰─────────────────────────╯
Variables:
<span style="color: #5c5cff">┗━━ </span>📓 proxy_mode: <span style="color: #00aa00">No proxy</span> ◀ loaded from the YAML file "config/02/config.yml"
</pre>

View file

@ -0,0 +1 @@
rougail -m firefox/ -u yaml -yf config/03/config.yml --cli.invalid_user_data_error

1
config/03/cmd_ro.txt Normal file
View file

@ -0,0 +1 @@
rougail -m firefox/ -u yaml -yf config/03/config.yml

2
config/03/config.yml Normal file
View file

@ -0,0 +1,2 @@
---
proxy_mode: 1

View file

@ -0,0 +1,4 @@
<pre><span style="font-weight: bold; color: #ff0000">🛑 Caution</span>
<span style="color: #ff0000">┗━━ </span>proxy_mode: <span style="color: #ff0000">🛑 the value "1" is an invalid string, it's not a string, it has</span>
<span style="color: #ff0000"> </span><span style="color: #ff0000">been loading from the YAML file "config/03/config.yml"</span>
</pre>

6
config/03/output_ro.html Normal file
View file

@ -0,0 +1,6 @@
<pre><span style="font-weight: bold; color: #ff0000">🛑 Caution</span>
<span style="color: #ff0000">┗━━ </span>proxy_mode
<span style="color: #ff0000"> </span><span style="color: #ff0000">┣━━ </span><span style="color: #ffff00">🔔 the value "1" is an invalid string, it's not a string, it will be </span>
<span style="color: #ff0000"> </span><span style="color: #ff0000"></span><span style="color: #ffff00">ignored when loading from the YAML file "config/03/config.yml"</span>
<span style="color: #ff0000"> </span><span style="color: #ff0000">┗━━ </span><span style="color: #ff0000">🛑 mandatory variable but has no value</span>
</pre>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 119 KiB

View file

@ -1,5 +1,5 @@
<p> <p>
<a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_000/./">.</a><br/> <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_001/./">.</a><br/>
└── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_000/./firefox/">firefox</a><br/> └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_001/./firefox/">firefox</a><br/>
    └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_000/./firefox/00-proxy.yml">00-proxy.yml</a><br/>     └── <a href="https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_001/./firefox/00-proxy.yml">00-proxy.yml</a><br/>
<br/><br/></p> <br/><br/></p>