feat: extend var options with type and deprecated (#462)

This commit is contained in:
Germain Lefebvre 2023-03-27 13:18:42 +02:00 committed by GitHub
parent 17a448d416
commit 3d544b3beb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 11 deletions

View File

@ -135,7 +135,7 @@ class Config():
"var": { "var": {
"name": "var", "name": "var",
"automatic": True, "automatic": True,
"subtypes": ["value", "example", "description"], "subtypes": ["value", "example", "description", "type", "deprecated"],
"allow_multiple": False "allow_multiple": False
}, },
"example": { "example": {

View File

@ -44,23 +44,29 @@ option1
: the name of the variable to which additional information should be added : the name of the variable to which additional information should be added
option2 option2
: supports `["value", "example", "description"]` as information scopes : supports `["value", "example", "description", "type", "deprecated"]` as information scopes
**Example:** #### `value`
```YAML ```yaml
# The `$` operator is required for the `value` option. It's an indicator for the parster to signalize that the `<value>`
# need to be parsed as JSON. The JSON string is then converted to YAML for the documentation.
# @var docker_registry_password:value: $ "secure_overwrite" # @var docker_registry_password:value: $ "secure_overwrite"
# @var docker_registry_password: $ "secure_overwrite" docker_registry_password: "secret"
```
# It's also possible to define more complex values. Keep in mind the `<value>` need to be a valid JSON string. #### `example`
# @var docker_registry_insecure: $ ["myregistrydomain.com:5000", "localhost:5000"]
# For the example option, the `$` operator is optional. If it is set, the `<value>` need to be a valid JSON ```yaml
# string as described above. If not, the value is passed to the documentation unformatted.
# @var docker_registry_password:example: $ "%8gv_5GA?" # @var docker_registry_password:example: $ "%8gv_5GA?"
# @var docker_registry_password:example: >
# %8gv_5GA?
# MyV3ryS3cur3P4ssw0rd
# @end
docker_registry_password: "secret"
```
#### `description`
```yaml
# @var docker_registry_password:description: Very secure password to login to the docker registry. # @var docker_registry_password:description: Very secure password to login to the docker registry.
# @var docker_registry_password:description: > # @var docker_registry_password:description: >
# Multi line description are possible as well. # Multi line description are possible as well.
@ -69,6 +75,21 @@ option2
docker_registry_password: "secret" docker_registry_password: "secret"
``` ```
#### `type`
```yaml
# @var docker_registry_password:type: string
docker_registry_password: "secret"
```
#### `deprecated`
```yaml
# @var docker_registry_password:deprecated: true
# @var docker_registry_password:deprecated: since v1.0.0
docker_registry_password: "secret"
```
### `@tag` ### `@tag`
Used tags within the Ansible task files will be auto-discovered. This identifier can be used to define tags manually or add extended information to discovered tags. Used tags within the Ansible task files will be auto-discovered. This identifier can be used to define tags manually or add extended information to discovered tags.