Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions choose/choose.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ package choose
import (
"strings"

"github.com/charmbracelet/bubbles/help"
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/paginator"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/bubbles/v2/help"
"github.com/charmbracelet/bubbles/v2/key"
"github.com/charmbracelet/bubbles/v2/paginator"
tea "github.com/charmbracelet/bubbletea/v2"
"github.com/charmbracelet/lipgloss/v2"
)

func defaultKeymap() keymap {
Expand Down
19 changes: 13 additions & 6 deletions choose/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,28 @@ import (
"sort"
"strings"

"github.com/charmbracelet/bubbles/help"
"github.com/charmbracelet/bubbles/paginator"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/bubbles/v2/help"
"github.com/charmbracelet/bubbles/v2/paginator"
tea "github.com/charmbracelet/bubbletea/v2"
"github.com/charmbracelet/gum/internal/stdin"
"github.com/charmbracelet/gum/internal/timeout"
"github.com/charmbracelet/gum/internal/tty"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/lipgloss/v2"
"github.com/charmbracelet/lipgloss/v2/compat"
)

// Run provides a shell script interface for choosing between different through
// options.
func (o Options) Run() error {
var (
subduedStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "#847A85", Dark: "#979797"})
verySubduedStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "#DDDADA", Dark: "#3C3C3C"})
subduedStyle = lipgloss.NewStyle().Foreground(compat.AdaptiveColor{
Light: lipgloss.Color("#847A85"),
Dark: lipgloss.Color("#979797"),
})
verySubduedStyle = lipgloss.NewStyle().Foreground(compat.AdaptiveColor{
Light: lipgloss.Color("#DDDADA"),
Dark: lipgloss.Color("#3C3C3C"),
})
)

input, _ := stdin.Read(stdin.StripANSI(o.StripANSI))
Expand Down
4 changes: 2 additions & 2 deletions confirm/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"os"

"github.com/charmbracelet/bubbles/help"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/bubbles/v2/help"
tea "github.com/charmbracelet/bubbletea/v2"
"github.com/charmbracelet/gum/internal/exit"
"github.com/charmbracelet/gum/internal/stdin"
"github.com/charmbracelet/gum/internal/timeout"
Expand Down
9 changes: 4 additions & 5 deletions confirm/confirm.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
package confirm

import (
"github.com/charmbracelet/bubbles/help"
"github.com/charmbracelet/bubbles/key"

tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/bubbles/v2/help"
"github.com/charmbracelet/bubbles/v2/key"
tea "github.com/charmbracelet/bubbletea/v2"
"github.com/charmbracelet/lipgloss/v2"
)

func defaultKeymap(affirmative, negative string) keymap {
Expand Down
4 changes: 1 addition & 3 deletions cursor/cursor.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cursor

import (
"github.com/charmbracelet/bubbles/cursor"
)
import "github.com/charmbracelet/bubbles/v2/cursor"

// Modes maps strings to cursor modes.
var Modes = map[string]cursor.Mode{
Expand Down
8 changes: 4 additions & 4 deletions file/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"os"
"path/filepath"

"github.com/charmbracelet/bubbles/filepicker"
"github.com/charmbracelet/bubbles/help"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/bubbles/v2/filepicker"
"github.com/charmbracelet/bubbles/v2/help"
tea "github.com/charmbracelet/bubbletea/v2"
"github.com/charmbracelet/gum/internal/timeout"
)

Expand All @@ -30,7 +30,7 @@ func (o Options) Run() error {
fp := filepicker.New()
fp.CurrentDirectory = path
fp.Path = path
fp.Height = o.Height
fp.SetHeight(o.Height)
fp.AutoHeight = o.Height == 0
fp.Cursor = o.Cursor
fp.DirAllowed = o.Directory
Expand Down
12 changes: 6 additions & 6 deletions file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
package file

import (
"github.com/charmbracelet/bubbles/filepicker"
"github.com/charmbracelet/bubbles/help"
"github.com/charmbracelet/bubbles/key"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/bubbles/v2/filepicker"
"github.com/charmbracelet/bubbles/v2/help"
"github.com/charmbracelet/bubbles/v2/key"
tea "github.com/charmbracelet/bubbletea/v2"
"github.com/charmbracelet/lipgloss/v2"
)

type keymap filepicker.KeyMap
Expand Down Expand Up @@ -69,7 +69,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.WindowSizeMsg:
if m.showHelp {
m.filepicker.Height -= lipgloss.Height(m.helpView())
m.filepicker.SetHeight(m.filepicker.Height() - lipgloss.Height(m.helpView()))
}
case tea.KeyMsg:
switch {
Expand Down
21 changes: 13 additions & 8 deletions filter/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"slices"
"strings"

"github.com/charmbracelet/bubbles/help"
"github.com/charmbracelet/bubbles/textinput"
"github.com/charmbracelet/bubbles/viewport"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/bubbles/v2/help"
"github.com/charmbracelet/bubbles/v2/textinput"
"github.com/charmbracelet/bubbles/v2/viewport"
tea "github.com/charmbracelet/bubbletea/v2"
"github.com/charmbracelet/gum/internal/files"
"github.com/charmbracelet/gum/internal/stdin"
"github.com/charmbracelet/gum/internal/timeout"
Expand All @@ -26,12 +26,17 @@ func (o Options) Run() error {
i.Focus()

i.Prompt = o.Prompt
i.PromptStyle = o.PromptStyle.ToLipgloss()
i.PlaceholderStyle = o.PlaceholderStyle.ToLipgloss()
i.Styles.Focused.Prompt = o.PromptStyle.ToLipgloss()
i.Styles.Blurred.Prompt = i.Styles.Focused.Prompt
i.Styles.Focused.Placeholder = o.PlaceholderStyle.ToLipgloss()
i.Styles.Blurred.Placeholder = i.Styles.Focused.Placeholder
i.Placeholder = o.Placeholder
i.Width = o.Width
i.SetWidth(o.Width)

v := viewport.New(o.Width, o.Height)
v := viewport.New(
viewport.WithWidth(o.Width),
viewport.WithHeight(o.Height),
)

if len(o.Options) == 0 {
if input, _ := stdin.Read(stdin.StripANSI(o.StripANSI)); input != "" {
Expand Down
Loading
Loading