ZupIT / ritchie-formulas-demo

This repository contains some demonstration formulas that can be executed through Ritchie CLI once imported. This tool is an open source product that allows you to create, store and share any kind of automations, executing them through command lines, to run operations or start workflows ⚙️ 🖥 💡
https://ritchiecli.io
Apache License 2.0
18 stars 11 forks source link

[FEATURE] Conditionnal Demo #34

Open GuillaumeFalourd opened 3 years ago

GuillaumeFalourd commented 3 years ago

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.

amandaveredas commented 2 years ago

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."
    }
  ]