ZupIT/ritchie-formulas-demo

[FEATURE] Conditionnal Demo

Opened this issue · 1 comments

What would you like to be added:

A formula demonstration showing how to use the conditionnal opcional fields on the config.json formula file.

More informations here: https://docs.ritchiecli.io/tutorials/formulas/how-to-implement-a-formula/config-file

Obs: The documentation will redirect to the formula's readme afterwards.

Why is this needed:

To give an example to Ritchie users.

I´m looking at documentation and this example is there:

Conditional input example with Regex pattern:

"inputs": [
    {
      "label": "Select a system:",
      "name": "rit_system",
      "type": "text",
      "items": [
        "LINUX",
        "MACOS",
        "WINDOWS"
      ],
      "required": true,
      "tutorial": "Select a System from the list."
    },
    {
      "condition": {
        "variable":"rit_system",
        "operator":"==",
        "value":"LINUX"
      },
      "label": "Select a LINUX OS:",
      "name": "rit_linux_os",
      "type": "text",
      "items": [
        "UBUNTU",
        "FEDORA",
        "CENTOS"
      ],
      "pattern": {
        "regex": "UBUNTU|FEDORA|CENTOS",
        "mismatchText": "Invalid option"
      },
      "required": false,
      "tutorial": "Select an Linux Operating System from the list."
    }
  ]