select

Present a list of options to the user and execute different sets of operations based on the selection.

Example

{
  "op": "select",
  "title": "Choose a styling library:",
  "selections": [
    { "label": "Styled Components", "value": "styled-components" },
    { "label": "Emotion", "value": "emotion" },
    { "label": "None", "value": "none" }
  ],
  "value": "$stylingLibrary",
  "values": {
    "styled-components": [
      {
        "op": "install",
        "dep": ["styled-components"],
        "devDep": ["@types/styled-components"]
      }
    ],
    "emotion": [
      {
        "op": "install",
        "dep": ["@emotion/react"],
        "devDep": ["@emotion/styled"]
      }
    ],
    "none": []
  }
}

Fields

FieldsTypeDescription
op'select'Specifies the type of operation. For SelectOperation, this field must be 'select'.
titlestringThe prompt message displayed to the user when presenting the selection.
selectionsSelection[]An array of selection options, each with a label and a value.
valuestringThe name of the variable where the selected value will be stored.
values{ [key: string]: Operation[] }An object mapping each selection value to an array of operations to execute if that value is selected.

Selection Fields

FieldsTypeDescription
labelstringThe text displayed to the user for this option.
valuestringThe internal value representing this option.