table-select: have got a basic loading indicator built
This commit is contained in:
parent
5d213c4ee8
commit
8b743351dd
3 changed files with 50 additions and 17 deletions
|
|
@ -24,6 +24,7 @@ import (
|
|||
"github.com/lmika/gopkgs/cli"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
@ -135,9 +136,18 @@ func newTestModel(descr string) tea.Model {
|
|||
OnKeyPressed: func(k string) tea.Cmd {
|
||||
log.Println("got key press: " + k)
|
||||
if k == "enter" {
|
||||
return tableselect.ShowTableSelect(func(n string) tea.Cmd {
|
||||
return statusandprompt.SetStatus("New table = " + n)
|
||||
})
|
||||
return tea.Batch(
|
||||
tableselect.IndicateLoadingTables(),
|
||||
tea.Sequentially(
|
||||
func() tea.Msg {
|
||||
<-time.After(2 * time.Second)
|
||||
return nil
|
||||
},
|
||||
tableselect.ShowTableSelect(func(n string) tea.Cmd {
|
||||
return statusandprompt.SetStatus("New table = " + n)
|
||||
}),
|
||||
),
|
||||
)
|
||||
} else if k == "k" {
|
||||
return modal.PopMode
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue