fix: use new API

This commit is contained in:
Maas Lalani 2023-03-03 16:47:24 -05:00
parent f1e04d11ec
commit cf64a39b5b
No known key found for this signature in database
GPG key ID: 5A6ED5CBF1A0A000
3 changed files with 8 additions and 5 deletions

View file

@ -29,10 +29,6 @@ func (m model) Init() tea.Cmd {
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case filepicker.FileSelectedMsg:
m.selectedPath = msg.Path
m.quitting = true
return m, tea.Quit
case tea.KeyMsg:
switch msg.String() {
case "ctrl+c", "q":
@ -41,6 +37,11 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
var cmd tea.Cmd
m.filepicker, cmd = m.filepicker.Update(msg)
if didSelect, path := m.filepicker.DidSelectFile(msg); didSelect {
m.selectedPath = path
m.quitting = true
return m, tea.Quit
}
return m, cmd
}

2
go.mod
View file

@ -5,7 +5,7 @@ go 1.18
require (
github.com/alecthomas/kong v0.7.1
github.com/alecthomas/mango-kong v0.1.0
github.com/charmbracelet/bubbles v0.15.1-0.20230303175231-2694acc38055
github.com/charmbracelet/bubbles v0.15.1-0.20230303214459-958a0ea710f1
github.com/charmbracelet/bubbletea v0.23.2
github.com/charmbracelet/glamour v0.6.0
github.com/charmbracelet/lipgloss v0.6.1-0.20230222162833-a74950e6da16

2
go.sum
View file

@ -25,6 +25,8 @@ github.com/charmbracelet/bubbles v0.15.0 h1:c5vZ3woHV5W2b8YZI1q7v4ZNQaPetfHuoHzx
github.com/charmbracelet/bubbles v0.15.0/go.mod h1:Y7gSFbBzlMpUDR/XM9MhZI374Q+1p1kluf1uLl8iK74=
github.com/charmbracelet/bubbles v0.15.1-0.20230303175231-2694acc38055 h1:4zkjfTm5xydSP+cZjgWyAmrjJXlx0E0E2DWu4x3r0vM=
github.com/charmbracelet/bubbles v0.15.1-0.20230303175231-2694acc38055/go.mod h1:2ZpQTAUWMFMWM5lx7FvucnwMOE+/JKP9d/Su1MKpZbo=
github.com/charmbracelet/bubbles v0.15.1-0.20230303214459-958a0ea710f1 h1:BcxSgchb4ZV1lJe9W9+LhQj6S3JouC39yYswVI4YOrw=
github.com/charmbracelet/bubbles v0.15.1-0.20230303214459-958a0ea710f1/go.mod h1:39HL8bnL0foloiENA/KvD+3mNg5SqWQV2Qh3eY/4ey4=
github.com/charmbracelet/bubbletea v0.22.1/go.mod h1:8/7hVvbPN6ZZPkczLiB8YpLkLJ0n7DMho5Wvfd2X1C0=
github.com/charmbracelet/bubbletea v0.23.1/go.mod h1:JAfGK/3/pPKHTnAS8JIE2u9f61BjWTQY57RbT25aMXU=
github.com/charmbracelet/bubbletea v0.23.2 h1:vuUJ9HJ7b/COy4I30e8xDVQ+VRDUEFykIjryPfgsdps=