Skip to content

x-prompt should support an array of defaults for lists #16104

Closed
@d-koppenhagen

Description

@d-koppenhagen

🚀 Feature request

Command (mark with an x)

- [x] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [x] generate
- [x] add
- [x] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Description

A clear and concise description of the problem or missing capability...

Within angular-cli 9.0.0-rc.0 it's possible to create schematics that will allow to use x-prompts with multi selection like this way:

{
  "$schema": "http://json-schema.org/schema",
  "id": "ngx-semantic-version",
  "title": "ngx-semantic-version Schema",
  "description": "configure commitlint, husky, commitizen and standard-version configuration",
  "type": "object",
  "properties": {
    "packages": {
      "type": "array",
      "description": "select the packages that should to be installed and configured",
      "uniqueItems": true,
      "items": {
        "type": "string"
      },
      "x-prompt": {
        "message": "What packages do you want to be installed and configured?",
        "type": "list",
        "multiselect": true,
        "items": ["commitlint", "commitizen", "husky", "standard-version"]
      }
    },
  },
  "required": ["packages"]
}

As the result of the x-prompt will lead into an array of values instead of a single selected value or input, it should be also supported to configure and array of default values.

Describe the solution you'd like

It should be possible to configure "default": ["foo", "bar"], inside the properties:

{
  "$schema": "http://json-schema.org/schema",
  "id": "ngx-semantic-version",
  "title": "ngx-semantic-version Schema",
  "description": "configure commitlint, husky, commitizen and standard-version configuration",
  "type": "object",
  "properties": {
    "packages": {
      "type": "array",
      "description": "select the packages that should to be installed and configured",
      "uniqueItems": true,
      "items": {
        "type": "string"
      },
      "default": ["commitlint", "commitizen", "husky", "standard-version"],
      "x-prompt": {
        "message": "What packages do you want to be installed and configured?",
        "type": "list",
        "multiselect": true,
        "items": ["commitlint", "commitizen", "husky", "standard-version"]
      }
    },
  },
  "required": ["packages"]
}

Describe alternatives you've considered

Have you considered any alternative solutions or workarounds?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions