Closed futuremotiondev closed 10 months ago
OK, I think I figured out what you were trying to do, and I can fix it if you want.
The variable $spectrePrompt
is of type [Spectre.Console.MultiSelectionPromptExtensions]
You can get a lowdown on the class here: https://spectreconsole.net/api/spectre.console/multiselectionpromptextensions/
Specifically these properties: https://spectreconsole.net/api/spectre.console/multiselectionpromptextensions/7a395d1e https://spectreconsole.net/api/spectre.console/multiselectionpromptextensions/99e03267
What you want is:
$spectrePrompt.Required = -not $AllowNoChoice
or
$spectrePrompt.Required = $RequireAChoice
It just comes down to how you want to word it. And then obviously you need to change the param from [switch] $AllowEmpty
to [switch] $RequireAChoice
If you want I can write a quick PR.
Hopefully you can reproduce.
When I run, I get: