Skip to content

Commit

Permalink
feat: better file picker
Browse files Browse the repository at this point in the history
  • Loading branch information
maaslalani committed Jan 31, 2024
1 parent 1dd48e0 commit 1530eef
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/alecthomas/chroma v0.10.1-0.20220126230913-d491f1b5c1d2
github.com/alecthomas/kong v0.8.1
github.com/beevik/etree v1.3.0
github.com/charmbracelet/huh v0.3.1-0.20240125205708-bb9c8f48a9f4
github.com/charmbracelet/huh v0.3.1-0.20240131194652-914f076c9207
github.com/charmbracelet/lipgloss v0.9.1
github.com/charmbracelet/log v0.3.1
github.com/mattn/go-isatty v0.0.20
Expand All @@ -16,8 +16,9 @@ require (
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/catppuccin/go v0.2.0 // indirect
github.com/charmbracelet/bubbles v0.17.2-0.20240129221336-07e7bd4ee418 // indirect
github.com/charmbracelet/bubbles v0.17.2-0.20240131162854-364eac96a867 // indirect
github.com/charmbracelet/bubbletea v0.25.0 // indirect
github.com/charmbracelet/x/exp/strings v0.0.0-20240130180102-bafe6fbaee60 // indirect
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
github.com/dlclark/regexp2 v1.10.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
Expand All @@ -30,7 +31,7 @@ require (
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/rivo/uniseg v0.4.6 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.16.0 // indirect
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ github.com/beevik/etree v1.3.0 h1:hQTc+pylzIKDb23yYprodCWWTt+ojFfUZyzU09a/hmU=
github.com/beevik/etree v1.3.0/go.mod h1:aiPf89g/1k3AShMVAzriilpcE4R/Vuor90y83zVZWFc=
github.com/catppuccin/go v0.2.0 h1:ktBeIrIP42b/8FGiScP9sgrWOss3lw0Z5SktRoithGA=
github.com/catppuccin/go v0.2.0/go.mod h1:8IHJuMGaUUjQM82qBrGNBv7LFq6JI3NnQCF6MOlZjpc=
github.com/charmbracelet/bubbles v0.17.2-0.20240129221336-07e7bd4ee418 h1:uvKilAnaaZbbqtI3KR8KXdEy2eqqm7F0lr1bmlPpUyE=
github.com/charmbracelet/bubbles v0.17.2-0.20240129221336-07e7bd4ee418/go.mod h1:bFPs/pcBrPDNRHK9DOOctOwvdSjRtdA5iFmhdQ/QT7w=
github.com/charmbracelet/bubbles v0.17.2-0.20240131162854-364eac96a867 h1:VgxgtJXJWTA3nTi9dKlM/VpcxoStRz+Iuv4UvOmjdBk=
github.com/charmbracelet/bubbles v0.17.2-0.20240131162854-364eac96a867/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw=
github.com/charmbracelet/bubbletea v0.25.0 h1:bAfwk7jRz7FKFl9RzlIULPkStffg5k6pNt5dywy4TcM=
github.com/charmbracelet/bubbletea v0.25.0/go.mod h1:EN3QDR1T5ZdWmdfDzYcqOCAps45+QIJbLOBxmVNWNNg=
github.com/charmbracelet/lipgloss v0.9.1 h1:PNyd3jvaJbg4jRHKWXnCj1akQm4rh8dbEzN1p/u1KWg=
github.com/charmbracelet/lipgloss v0.9.1/go.mod h1:1mPmG4cxScwUQALAAnacHaigiiHB9Pmr+v1VEawJl6I=
github.com/charmbracelet/log v0.3.1 h1:TjuY4OBNbxmHWSwO3tosgqs5I3biyY8sQPny/eCMTYw=
github.com/charmbracelet/log v0.3.1/go.mod h1:OR4E1hutLsax3ZKpXbgUqPtTjQfrh1pG3zwHGWuuq8g=
github.com/charmbracelet/x/exp/strings v0.0.0-20240130180102-bafe6fbaee60 h1:/FTPkYsiq7rXip2GU4gn7NvkXqoiN7Rt8nyuL/MGzQ8=
github.com/charmbracelet/x/exp/strings v0.0.0-20240130180102-bafe6fbaee60/go.mod h1:pBhA0ybfXv6hDjQUZ7hk1lVxBiUbupdw5R31yPUViVQ=
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY=
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -63,8 +65,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA=
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
5 changes: 2 additions & 3 deletions interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ func runForm(config *Config) (*Config, error) {
theme := huh.ThemeCharm()
theme.FieldSeparator = lipgloss.NewStyle()
theme.Blurred.TextInput.Text = theme.Blurred.TextInput.Text.Copy().Foreground(lipgloss.Color("243"))
theme.Blurred.Title = theme.Blurred.Title.Copy().Width(14).Foreground(lipgloss.Color("7"))
theme.Focused.Title = theme.Focused.Title.Copy().Width(14).Foreground(green).Bold(true)
theme.Blurred.Description = theme.Blurred.Description.Copy().Foreground(lipgloss.Color("0"))
theme.Focused.Description = theme.Focused.Description.Copy().Foreground(lipgloss.Color("7"))
theme.Blurred.BlurredButton = lipgloss.NewStyle().Foreground(lipgloss.Color("8")).PaddingRight(1)
Expand All @@ -48,7 +46,6 @@ func runForm(config *Config) (*Config, error) {
huh.NewGroup(
huh.NewNote().Title("Capture file"),
huh.NewFilePicker().
Height(10).
Value(&config.Input),
),
).
Expand All @@ -66,6 +63,8 @@ func runForm(config *Config) (*Config, error) {
config.Output = strings.TrimSuffix(base, ext) + ".svg"
}

theme.Blurred.Title = theme.Blurred.Title.Copy().Width(14).Foreground(lipgloss.Color("7"))
theme.Focused.Title = theme.Focused.Title.Copy().Width(14).Foreground(green).Bold(true)
theme.Focused.Base.
Border(lipgloss.Border{Left: "> "}, false).
BorderLeft(true).
Expand Down

0 comments on commit 1530eef

Please sign in to comment.