Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

[FEATURE] Pattern (regex) Demo #35

Open
GuillaumeFalourd opened this issue Dec 22, 2020 · 2 comments
Open

[FEATURE] Pattern (regex) Demo #35

GuillaumeFalourd opened this issue Dec 22, 2020 · 2 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers

Comments

@GuillaumeFalourd
Copy link
Contributor

What would you like to be added:

A formula demonstration showing how to use the pattern (regex) 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.

@GuillaumeFalourd GuillaumeFalourd added documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers labels Dec 22, 2020
@amandaveredas
Copy link

I´m looking at documentation and this example is there. That's not enough?

"label": "What is your age",
      "name": "rit_age",
      "type": "text",
      "pattern": {
            "regex": "[0-9]",
            "mismatchText": "Only a integer value is allowed here (ex: 20)"
      }
}

@amandaveredas
Copy link

Other example using regex in the Richie documentation:

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants