[tutorial 003] A first variable (config and doc)

This commit is contained in:
egarette@silique.fr 2024-09-07 19:06:28 +02:00
parent 7ea014c4a4
commit 35480173a8
6 changed files with 145 additions and 0 deletions

136
README.md
View file

@ -7,6 +7,7 @@ include_toc: true
- [[tutorial 001] An empty file](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 002] A first 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))
- [[tutorial 003] A first variable](https://forge.cloud.silique.fr/stove/rougail-tutorials/src/commit/v1.1_003/README.md) ([diff](https://forge.cloud.silique.fr/stove/rougail-tutorials/compare/v1.1_003~1..v1.1_003))
# Description
@ -33,6 +34,7 @@ Were gonna create a first variable called "proxy_mode":
```yml
---
proxy_mode:
```
## Generated documentation
@ -40,3 +42,137 @@ Were gonna create a first variable called "proxy_mode":
```console
foo@bar:~$ rougail -v 1.1 -m firefox/ -o doc -do github
```
### Variables
| Variable                                                                                                | Description                                                                                             |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **proxy_mode**<br/>[`string`](https://rougail.readthedocs.io/en/latest/variable.html#variables-types) `basic` `mandatory` | Proxy_mode. |
# User data
## Example 1
### config/01/config.yaml
```yml
---
```
### Description
The user data file is empty. So it's only default value that will be used.
### Output
```console
foo@bar:~$ rougail -v 1.1 -m firefox -u file -ff config/01/config.yaml
```
<pre>🛑 ERRORS
<span style="color: #ff0000">┣━━ </span>The following variables are mandatory but have no value:
<span style="color: #ff0000">┗━━ </span> - proxy_mode
</pre>
## Example 2
### config/02/config.yaml
```yml
---
proxy_mode: No proxy
```
### Output
```console
foo@bar:~$ rougail -v 1.1 -m firefox -u file -ff config/02/config.yaml
```
<pre>╭────────────────────────── Caption ──────────────────────────╮
│ Variable <span style="color: #ffd700">Default value</span>
<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: #ffaf00">Unmodifiable variable</span>
╰─────────────────────────────────────────────────────────────╯
Variables:
<span style="color: #5c5cff">┗━━ </span>📓 proxy_mode: No proxy
</pre>
## Example 3
### config/03/config.yaml
```yml
---
proxy_mode: Manual proxy configuration
```
### Output
```console
foo@bar:~$ rougail -v 1.1 -m firefox -u file -ff config/03/config.yaml
```
<pre>╭────────────────────────── Caption ──────────────────────────╮
│ Variable <span style="color: #ffd700">Default value</span>
<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: #ffaf00">Unmodifiable variable</span>
╰─────────────────────────────────────────────────────────────╯
Variables:
<span style="color: #5c5cff">┗━━ </span>📓 proxy_mode: Manual proxy configuration
</pre>
## Example 4
### config/04/config.yaml
```yml
---
proxy_mode: foo
```
### Description
"foo" should be an invalid value for this variable.
### Output
```console
foo@bar:~$ rougail -v 1.1 -m firefox -u file -ff config/04/config.yaml
```
<pre>╭────────────────────────── Caption ──────────────────────────╮
│ Variable <span style="color: #ffd700">Default value</span>
<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: #ffaf00">Unmodifiable variable</span>
╰─────────────────────────────────────────────────────────────╯
Variables:
<span style="color: #5c5cff">┗━━ </span>📓 proxy_mode: foo
</pre>
## Example 5
### config/05/config.yaml
```yml
---
proxy_mode: 1
```
### Description
The integer value "1" is invalid.
### Output
```console
foo@bar:~$ rougail -v 1.1 -m firefox -u file -ff config/05/config.yaml
```
<pre>🛑 ERRORS
<span style="color: #ff0000">┣━━ </span>'1' is an invalid string for 'proxy_mode'
<span style="color: #ff0000">┣━━ </span>The following variables are mandatory but have no value:
<span style="color: #ff0000">┗━━ </span> - proxy_mode
</pre>

1
config/01/config.yaml Normal file
View file

@ -0,0 +1 @@
---

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

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

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

@ -0,0 +1,2 @@
---
proxy_mode: Manual proxy configuration

2
config/04/config.yaml Normal file
View file

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

2
config/05/config.yaml Normal file
View file

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