Skip to content

Interactive mode for disambiguation prompts #3784

@martinlingstuyl

Description

@martinlingstuyl

It would be a nice idea to have some extra interactivity in the CLI.

As an example see how the jira CLI deals with lists.

For the CLI there are several places where such an interactive experience might be helpful.

Scenario

There are a lot of places in the CLI where it is possible for the user to enter a name or a title or some such. The CLI will try to find the related object. Such as a team. However: if multiple objects with the same name exist, the CLI will request the user to select the proper object. This is done by printing the ids and titles to the terminal. It's called a disambiguating prompt. The user must copy paste the value he wants and execute the command again.

It would be cool to have some extra interactivity here:
When a command triggers the user to disambiguate, allow the user to select the correct option using the up, down and enter keys, after which the command is executed again on the proper item.

Implementation

  • add new boolean configuration setting interactive that will enable the disambiguation prompt. It will be disabled by default to avoid introducing breaking changes and preventing CLI from being used in scripts
  • when the interactive setting is set to true and there's an ambiguity error, CLI will show a choice prompt using inquirer showing the different options
  • if user selects an option from the list, CLI will assign the selected value to the corresponding option and proceed with execution
  • if a user cancels the prompt, CLI will stop execution

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions