update custom type
This commit is contained in:
parent
5039060012
commit
847205938d
2 changed files with 21 additions and 17 deletions
|
|
@ -63,7 +63,6 @@ Rougail
|
|||
:caption: Load values from user datas
|
||||
|
||||
user_datas/index
|
||||
configuration
|
||||
|
||||
.. toctree::
|
||||
:titlesonly:
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Custom type
|
|||
|
||||
.. objectives:: Objectives
|
||||
|
||||
We are going to learn how to create custom types.
|
||||
In this sections we are going to learn how to create custom types.
|
||||
In short, a custom type is nothing more than a kind of family template.
|
||||
|
||||
.. prerequisites:: Prerequisites
|
||||
|
|
@ -27,11 +27,12 @@ Custom type
|
|||
HTTP Proxy with "proxy" type
|
||||
--------------------------------
|
||||
|
||||
In this section we will look at the possibilities for adding types.
|
||||
Let's look now at the possibilities for adding types.
|
||||
This feature is essential for having a truly adaptable tool.
|
||||
|
||||
.. note:: It is actually possible to add static predefined types,
|
||||
but that involves modifying the :term:`tiramisu` library itself.
|
||||
.. note:: It is actually possible to add types,
|
||||
but that involves adding predefined types to the :term:`tiramisu` underlying consistency library itself,
|
||||
and that’s a different matter altogether. There is a simpler way to do this.
|
||||
|
||||
More simply, it's possible in Rougail to create custom types, much like defining families.
|
||||
|
||||
|
|
@ -41,9 +42,11 @@ Our folder structure will be expanded a bit:
|
|||
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_080/tree.html
|
||||
|
||||
Notice that we have now a new :file:`types` folder in our tree structure.
|
||||
This is where we place our new type definitions.
|
||||
This is where we place our new `proxy` type definition.
|
||||
|
||||
Let's examine them more closely this new structure file named :file:`types/proxy/00_type.yml`:
|
||||
In accordance with our :ref:`naming policy <namingconvention>`, we have created a file named :file:`00_type.yml`
|
||||
inside the `proxy` folder.
|
||||
Let's examine this more closely this :file:`types/proxy/00_type.yml` type definition file:
|
||||
|
||||
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_080/types/proxy/00_type.yml
|
||||
:language: yaml
|
||||
|
|
@ -71,15 +74,14 @@ Let's examine them more closely this new structure file named :file:`types/proxy
|
|||
variable: __.http_proxy.port
|
||||
...
|
||||
|
||||
Now a new type named `proxy` is declared.
|
||||
It's more or less like a family except it will be used as a type definition,
|
||||
|
||||
The new type named `proxy` is declared.
|
||||
It's more or less like a family declaration except it will be used as a type definition.
|
||||
|
||||
.. questions:: How do we use a new type?
|
||||
|
||||
Very simply. In the usual way.
|
||||
Very simply. In the usual way: we will use the `type` parameter.
|
||||
|
||||
Here, we will declare that a family is of type `proxy` as follows:
|
||||
Here, we will declare that a family is of type `proxy` as follows:
|
||||
|
||||
.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_080/firefox/10-manual.yml
|
||||
:language: yaml
|
||||
|
|
@ -107,17 +109,16 @@ It's more or less like a family except it will be used as a type definition,
|
|||
default: 8080
|
||||
...
|
||||
|
||||
We can see that the `http_proxy` family has the `type: proxy` declared. Very simple.
|
||||
We can see that the type declared for the `http_proxy` family is `type: proxy`. Very simple.
|
||||
|
||||
So we have declared our new type. How do you make it available in our structure file definitions?
|
||||
|
||||
The Rougail CLI with the type declaration command line option:
|
||||
So we have declared our new type. How do we make it available? Well, the Rougail CLI has a `--types` type declaration command line option.
|
||||
Let's launch the rougail CLI:
|
||||
|
||||
.. raw:: html
|
||||
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_080/config/01/cmd_ro.txt
|
||||
:class: terminal
|
||||
|
||||
The output:
|
||||
The output is:
|
||||
|
||||
.. raw:: html
|
||||
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/commit/v1.1_080/config/01/output_ro.html
|
||||
|
|
@ -151,4 +152,8 @@ TODO:
|
|||
┣━━ 📓 SOCKS port: 3128
|
||||
┗━━ 📓 SOCKS host version used by proxy: v5
|
||||
|
||||
.. keypoints:: Key points
|
||||
|
||||
- type declaration
|
||||
- type usage
|
||||
-
|
||||
|
|
|
|||
Loading…
Reference in a new issue