Closed
Description
Is your feature request related to a problem? Please describe.
I would love when using SelectionPrompt
or MultiSelectionPrompt
with choice groups, that I could get both the selected item, but also the group it belongs to as output.
Consider this code:
var api = AnsiConsole.Prompt(
new SelectionPrompt<string>()
.Title("What API do you want to explore?")
.PageSize(10)
.MoreChoicesText("[grey](Move up and down to reveal more options)[/]")
.AddChoiceGroup("Cloud API", new string []
{
"Booking API"
})
.AddChoiceGroup("Site API", new string[]
{
"Booking API"
}));
If I have the same choice in different groups, I would like to know which group it belongs to.
Right now I would have to wrap the strings in my own little class such as:
public class Choice
{
public string Name { get; set; }
public string Group { get; set; }
public override string ToString() => Name;
}
Describe the solution you'd like
A clear and concise description of what you want to happen.
Would be great if somehow SelectionPrompt
and MultiSelectionPrompt
could somehow also return the choice group when returning a value.
Metadata
Metadata
Assignees
Type
Projects
Status
Done 🚀