From 3d544b3beb7e61d7a6e875932b22e3b3da62e19d Mon Sep 17 00:00:00 2001 From: Germain Lefebvre <7525033+germainlefebvre4@users.noreply.github.com> Date: Mon, 27 Mar 2023 13:18:42 +0200 Subject: [PATCH] feat: extend var options with type and deprecated (#462) --- ansibledoctor/config.py | 2 +- docs/content/usage/getting-started.md | 41 ++++++++++++++++++++------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/ansibledoctor/config.py b/ansibledoctor/config.py index 644565a..802db32 100644 --- a/ansibledoctor/config.py +++ b/ansibledoctor/config.py @@ -135,7 +135,7 @@ class Config(): "var": { "name": "var", "automatic": True, - "subtypes": ["value", "example", "description"], + "subtypes": ["value", "example", "description", "type", "deprecated"], "allow_multiple": False }, "example": { diff --git a/docs/content/usage/getting-started.md b/docs/content/usage/getting-started.md index 940461f..c4c68b5 100644 --- a/docs/content/usage/getting-started.md +++ b/docs/content/usage/getting-started.md @@ -44,23 +44,29 @@ option1 : the name of the variable to which additional information should be added option2 -: supports `["value", "example", "description"]` as information scopes +: supports `["value", "example", "description", "type", "deprecated"]` as information scopes -**Example:** +#### `value` -```YAML -# The `$` operator is required for the `value` option. It's an indicator for the parster to signalize that the `` -# need to be parsed as JSON. The JSON string is then converted to YAML for the documentation. +```yaml # @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 `` need to be a valid JSON string. -# @var docker_registry_insecure: $ ["myregistrydomain.com:5000", "localhost:5000"] +#### `example` -# For the example option, the `$` operator is optional. If it is set, the `` need to be a valid JSON -# string as described above. If not, the value is passed to the documentation unformatted. +```yaml # @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: > # Multi line description are possible as well. @@ -69,6 +75,21 @@ option2 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` 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.