forked from Mirrors/bubbletea
Update animated progress bar example per its current API
This commit is contained in:
parent
60ddf33992
commit
749e48df11
|
@ -3,7 +3,7 @@ module examples
|
||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/charmbracelet/bubbles v0.8.1-0.20210823194501-985ffcb3197a
|
github.com/charmbracelet/bubbles v0.8.1-0.20210907175746-b691d7f07e25
|
||||||
github.com/charmbracelet/bubbletea v0.14.1
|
github.com/charmbracelet/bubbletea v0.14.1
|
||||||
github.com/charmbracelet/glamour v0.2.0
|
github.com/charmbracelet/glamour v0.2.0
|
||||||
github.com/charmbracelet/lipgloss v0.3.0
|
github.com/charmbracelet/lipgloss v0.3.0
|
||||||
|
|
|
@ -9,8 +9,8 @@ github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkx
|
||||||
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
|
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
|
||||||
github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY=
|
github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY=
|
||||||
github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
|
github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
|
||||||
github.com/charmbracelet/bubbles v0.8.1-0.20210823194501-985ffcb3197a h1:wnAi5RgUrYMsfjx8grJXMdXNLKWJMqUzbOayoIssTCY=
|
github.com/charmbracelet/bubbles v0.8.1-0.20210907175746-b691d7f07e25 h1:iivPooBtdJV/i//6Zktuvr6CnF11xKp9H+Poy497PqY=
|
||||||
github.com/charmbracelet/bubbles v0.8.1-0.20210823194501-985ffcb3197a/go.mod h1:NWT/c+0rYEnYChz5qCyX4Lj6fDw9gGToh9EFJPajghU=
|
github.com/charmbracelet/bubbles v0.8.1-0.20210907175746-b691d7f07e25/go.mod h1:NWT/c+0rYEnYChz5qCyX4Lj6fDw9gGToh9EFJPajghU=
|
||||||
github.com/charmbracelet/glamour v0.2.0 h1:mTgaiNiumpqTZp3qVM6DH9UB0NlbY17wejoMf1kM8Pg=
|
github.com/charmbracelet/glamour v0.2.0 h1:mTgaiNiumpqTZp3qVM6DH9UB0NlbY17wejoMf1kM8Pg=
|
||||||
github.com/charmbracelet/glamour v0.2.0/go.mod h1:UA27Kwj3QHialP74iU6C+Gpc8Y7IOAKupeKMLLBURWM=
|
github.com/charmbracelet/glamour v0.2.0/go.mod h1:UA27Kwj3QHialP74iU6C+Gpc8Y7IOAKupeKMLLBURWM=
|
||||||
github.com/charmbracelet/harmonica v0.1.0 h1:lFKeSd6OAckQ/CEzPVd2mqj+YMEubQ/3FM2IYY3xNm0=
|
github.com/charmbracelet/harmonica v0.1.0 h1:lFKeSd6OAckQ/CEzPVd2mqj+YMEubQ/3FM2IYY3xNm0=
|
||||||
|
|
|
@ -70,8 +70,8 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
|
|
||||||
// FrameMsg is sent when the progress bar wants to animate itself
|
// FrameMsg is sent when the progress bar wants to animate itself
|
||||||
case progress.FrameMsg:
|
case progress.FrameMsg:
|
||||||
var cmd tea.Cmd
|
progressModel, cmd := m.progress.Update(msg)
|
||||||
m.progress, cmd = m.progress.Update(msg)
|
m.progress = progressModel.(progress.Model)
|
||||||
return m, cmd
|
return m, cmd
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -87,7 +87,7 @@ func (e model) View() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func tickCmd() tea.Cmd {
|
func tickCmd() tea.Cmd {
|
||||||
return tea.Tick(time.Second*2, func(t time.Time) tea.Msg {
|
return tea.Tick(time.Second*1, func(t time.Time) tea.Msg {
|
||||||
return tickMsg(t)
|
return tickMsg(t)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue