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

WithOnInterruptFunc should default to exiting the program #592

Closed
panbanda opened this issue Dec 16, 2023 · 0 comments · Fixed by #593
Closed

WithOnInterruptFunc should default to exiting the program #592

panbanda opened this issue Dec 16, 2023 · 0 comments · Fixed by #593
Labels
bug Something isn't working

Comments

@panbanda
Copy link
Contributor

A change was added in #507 which allowed for more graceful termination, however the default functionality does not properly exit.

package main

import (
	"fmt"

	"github.com/pterm/pterm"
)


func main() {
	list := []string{"hello", "world", "example"}

	selectedItem, _ := pterm.DefaultInteractiveSelect.
		WithDefaultText("Select an item").
		WithMaxHeight(20).
		WithOptions(list).
		Show()

	fmt.Println("selected item:", selectedItem)
}

Expected output when running Ctrl + C

$ go run main.go
Select an item [type to search]: 
> hello
  world
  example
exit status 1

Actual output:

$ go run main.go
Select an item [type to search]: 
> hello
  world
  example
selected item: hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant