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

Feature: Add timeout option to interactive confirm printer. #568

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
f282028
wip: add timeout option to interactive confirm printer
Aug 30, 2023
19321a9
Merge branch 'master' into issue-543_Add_timeout_to_interactive_confirm
KarolosLykos Sep 3, 2023
5caab0a
mod: added timeout timer and timeout timer style
Sep 14, 2023
b0003e1
Merge branch 'pterm:master' into issue-543_Add_timeout_to_interactive…
KarolosLykos Sep 14, 2023
734702d
Merge branch 'master' into issue-543_Add_timeout_to_interactive_confirm
MarvinJWendt Sep 15, 2023
491f206
Merge branch 'master' into issue-543_Add_timeout_to_interactive_confirm
KarolosLykos Sep 21, 2023
783fcab
Merge branch 'master' into issue-543_Add_timeout_to_interactive_confirm
KarolosLykos Oct 17, 2023
e9fcfde
Merge branch 'master' into issue-543_Add_timeout_to_interactive_confirm
MarvinJWendt Oct 20, 2023
745554f
chore(interactive_confirm_printer): remove failing tests due to windo…
KarolosLykos Oct 23, 2023
1e83957
chore(interactive_confirm_printer): remove failing tests due to windo…
KarolosLykos Oct 23, 2023
d08dcd0
chore(interactive_confirm_printer): pause before simulating key
KarolosLykos Oct 23, 2023
2e4c033
chore(interactive_confirm_printer): pause before simulating key
KarolosLykos Oct 23, 2023
ceae4be
Merge branch 'master' into issue-543_Add_timeout_to_interactive_confirm
MarvinJWendt Dec 16, 2023
678c999
Merge branch 'master' into issue-543_Add_timeout_to_interactive_confirm
KarolosLykos Dec 17, 2023
87a5b4a
Merge branch 'master' into issue-543_Add_timeout_to_interactive_confirm
MarvinJWendt Feb 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore(interactive_confirm_printer): pause before simulating key
  • Loading branch information
KarolosLykos committed Oct 23, 2023
commit d08dcd05fef2d14198312ee6f09998ac2ed420f9
7 changes: 5 additions & 2 deletions interactive_confirm_printer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

func TestInteractiveConfirmPrinter_Show_yes(t *testing.T) {
go func() {
time.Sleep(200 * time.Millisecond)
time.Sleep(500 * time.Millisecond)
keyboard.SimulateKeyPress('y')
}()
result, _ := pterm.DefaultInteractiveConfirm.Show()
Expand All @@ -24,7 +24,7 @@ func TestInteractiveConfirmPrinter_Show_yes(t *testing.T) {

func TestInteractiveConfirmPrinter_Show_no(t *testing.T) {
go func() {
time.Sleep(200 * time.Millisecond)
time.Sleep(500 * time.Millisecond)
keyboard.SimulateKeyPress('n')
}()
result, _ := pterm.DefaultInteractiveConfirm.Show()
Expand All @@ -38,6 +38,7 @@ func TestInteractiveConfirmPrinter_WithDefaultValue(t *testing.T) {

func TestInteractiveConfirmPrinter_WithDefaultValue_false(t *testing.T) {
go func() {
time.Sleep(500 * time.Millisecond)
keyboard.SimulateKeyPress(keys.Enter)
}()
p := pterm.DefaultInteractiveConfirm.WithDefaultValue(false)
Expand All @@ -47,6 +48,7 @@ func TestInteractiveConfirmPrinter_WithDefaultValue_false(t *testing.T) {

func TestInteractiveConfirmPrinter_WithDefaultValue_true(t *testing.T) {
go func() {
time.Sleep(500 * time.Millisecond)
keyboard.SimulateKeyPress(keys.Enter)
}()
p := pterm.DefaultInteractiveConfirm.WithDefaultValue(true)
Expand Down Expand Up @@ -122,6 +124,7 @@ func TestInteractiveConfirmPrinter_CustomAnswers(t *testing.T) {
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
go func() {
time.Sleep(500 * time.Millisecond)
keyboard.SimulateKeyPress(tc.key)
}()
result, _ := p.Show()
Expand Down