Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples: fixed interactive_multiselect examples #606

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 0 additions & 5 deletions _examples/interactive_multiselect/custom-checkmarks/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ func init() {

time.Sleep(time.Second)

for i := 0; i < 2; i++ {
keyboard.SimulateKeyPress(keys.Down)
time.Sleep(time.Millisecond * 300)
}

keyboard.SimulateKeyPress(keys.Enter)
time.Sleep(time.Millisecond * 350)
keyboard.SimulateKeyPress(keys.Tab)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"atomicgo.dev/keyboard/keys"
"fmt"
"github.com/pterm/pterm"
)
Expand All @@ -16,12 +15,10 @@ func main() {
}

// Create a new interactive multiselect printer with the options
// Disable the filter, set the keys for confirming and selecting, and define the checkmark symbols
// Disable the filter and define the checkmark symbols
printer := pterm.DefaultInteractiveMultiselect.
WithOptions(options).
WithFilter(false).
WithKeyConfirm(keys.Enter).
WithKeySelect(keys.Space).
WithCheckmark(&pterm.Checkmark{Checked: pterm.Green("+"), Unchecked: pterm.Red("-")})

// Show the interactive multiselect and get the selected options
Expand Down