Prerequisites

Installation

We assume that Rougail’s command line is installed on your computer.

Verify that you have correctly installed the tool by running:

     $ rougail --cli.versions
     tiramisu: x.x.x
     tiramisu-cmdline-parser: x.x.x
     rougail: x.x.x
     rougail-cli: x.x.x
     rougail-user-data-ansible: x.x.x
     rougail-user-data-bitwarden: x.x.x
     rougail-user-data-commandline: x.x.x
     rougail-user-data-environment: x.x.x
     rougail-user-data-questionary: x.x.x
     rougail-user-data-yaml: x.x.x
     rougail-output-ansible: x.x.x
     rougail-output-display: x.x.x
     rougail-output-doc: x.x.x
     rougail-output-formatter: x.x.x
     rougail-output-json: x.x.x
     rougail-output-table: x.x.x

Smoke test

We need a Rougail structured data file to test and illustrate the different user data loading modules.

A example of structured data file place in the example.yaml structure file
%YAML 1.2
---
version: 1.1

person:  # Description of a person


  firstname:  # Last name of the person

  lastnames: []  # Last names of the person

  age:
    description: Person's age
    type: integer
    params:
      min_integer: 0
      max_integer: 120

  legal_age:
    description: The person is of legal age
    type: boolean
    default:
      jinja: |-
        {{ _.age is not none and _.age >= 18 }}
    hidden: true

  drive_license:
    description: The person has a driver's license
    default: false
    disabled:
      variable: _.legal_age
      when_not: true

  means_of_transport:
    description: Means of transport used by the person
    choices:
      - human-powered
      - public transport
      - electric-assisted vehicle
      - engine-powered without a license
      - engine-powered
      - others
    validators:
      - jinja: |-
          {% if _.means_of_transport == "engine-powered" %}
            {% if _.drive_license is propertyerror %}
              {{ _.lastnames[0] }} {{ _.firstname }} is not of legal age but declares that he uses an engine-powered
            {% elif not _.drive_license %}
              {{ _.lastnames[0] }} {{ _.firstname }} does not have a license but declares that he uses an engine-powered
            {% endif %}
          {% endif %}
        description: Engine-powered are only permitted for individuals with a driver's license
...

Let’s test this structured file:

     $ rougail -m example.yaml

The output has to be:

🛑 Caution ┗━━ Description of a person ┣━━ Last name of the person: 🛑 mandatory variable but has no value ┣━━ Last names of the person: 🛑 mandatory variable but has no value ┣━━ Person's age: 🛑 mandatory variable but has no value ┗━━ Means of transport used by the person: 🛑 mandatory variable but has no value