Skip to content

Commit

Permalink
Merge pull request #19 from fmotion1/prerelease
Browse files Browse the repository at this point in the history
Update Read-SpectreMultiSelection.ps1
  • Loading branch information
ShaunLawrie authored Jan 3, 2024
2 parents ec2d361 + 0f2bb34 commit fe334a3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ pnpm-debug.log*

# Exclude packages folder
PwshSpectreConsole/packages

# Exclude working folder
Working/
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ function Read-SpectreMultiSelection {
.PARAMETER PageSize
The number of choices to display per page. Defaults to 5.
.PARAMETER AllowEmpty
Allow the multi-selection to be submitted without any options chosen.
.EXAMPLE
# Displays a multi-selection prompt with the title "Select your favourite fruits", the list of fruits, the "Name" property as the label for each fruit, the color green for highlighting the selected fruits, and 3 fruits per page.
Read-SpectreMultiSelection -Title "Select your favourite fruits" -Choices @("apple", "banana", "orange", "pear", "strawberry") -Color "Green" -PageSize 3
Expand Down Expand Up @@ -55,7 +58,7 @@ function Read-SpectreMultiSelection {
$spectrePrompt.Title = $Title
$spectrePrompt.PageSize = $PageSize
$spectrePrompt.WrapAround = $true
$spectrePrompt.AllowEmpty = $AllowEmpty
$spectrePrompt.Required = !$AllowEmpty
$spectrePrompt.HighlightStyle = [Spectre.Console.Style]::new(($Color | Convert-ToSpectreColor))
$spectrePrompt.InstructionsText = "[$($script:DefaultValueColor.ToMarkup())](Press [$($script:AccentColor.ToMarkup())]space[/] to toggle a choice and press [$($script:AccentColor.ToMarkup())]<enter>[/] to submit your answer)[/]"
$spectrePrompt.MoreChoicesText = "[$($script:DefaultValueColor.ToMarkup())](Move up and down to reveal more choices)[/]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ function Read-SpectreMultiSelectionGrouped {
.PARAMETER PageSize
The number of choices to display per page. The default value is 10.
.PARAMETER AllowEmpty
Allow the multi-selection to be submitted without any options chosen.
.EXAMPLE
# This example displays a multi-selection prompt with two groups of choices: "Primary Colors" and "Secondary Colors". The prompt uses the "Name" property of each choice as the label. The user can select one or more choices from each group.
Read-SpectreMultiSelectionGrouped -Title "Select your favorite colors" -Choices @(
Expand Down

0 comments on commit fe334a3

Please sign in to comment.