Debian Codegraph @

examples/dynamic/dynamic-increment/main.go

raw symbols SCIP
1 package main
2
3 import (
4 "fmt"
5 "time"
6
7 "github.com/charmbracelet/huh"
8 )
9
10 func main() {
11
12 count := 0
13 go func() {
14 for {
15 count++
16 time.Sleep(1 * time.Second)
17 }
18 }()
19
20 descriptionFunc := func() string {
21 return fmt.Sprintf("The count is: %d", count)
22 }
23
24 huh.NewForm(huh.NewGroup(
25 huh.NewInput().
26 Title("Fill in the input").
27 DescriptionFunc(descriptionFunc, &count),
28 huh.NewInput().
29 Title("Fill in the input").
30 DescriptionFunc(descriptionFunc, &count),
31 )).Run()
32
33 }