Skip to content

Commit

Permalink
fix(filter): abort on ctrl+q (#721)
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <[email protected]>
  • Loading branch information
caarlos0 authored Dec 3, 2024
1 parent cb61fe6 commit 63a3e8c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions choose/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"slices"
"strings"

"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/huh"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/x/ansi"
Expand Down Expand Up @@ -35,6 +36,8 @@ func (o Options) Run() error {
}

theme := huh.ThemeCharm()
keymap := huh.NewDefaultKeyMap()
keymap.Quit = key.NewBinding(key.WithKeys("ctrl+c", "ctrl+q"))
options := huh.NewOptions(o.Options...)

theme.Focused.Base = lipgloss.NewStyle()
Expand Down Expand Up @@ -84,6 +87,7 @@ func (o Options) Run() error {
WithWidth(width).
WithShowHelp(o.ShowHelp).
WithTheme(theme).
WithKeyMap(keymap).
WithTimeout(o.Timeout).
Run()
if err != nil {
Expand All @@ -109,6 +113,7 @@ func (o Options) Run() error {
).
WithWidth(width).
WithTheme(theme).
WithKeyMap(keymap).
WithTimeout(o.Timeout).
WithShowHelp(o.ShowHelp).
Run()
Expand Down

0 comments on commit 63a3e8c

Please sign in to comment.