Debian Codegraph @

spinner/examples/context/main.go

raw symbols SCIP
1 package main
2
3 import (
4 "context"
5 "fmt"
6 "time"
7
8 "github.com/charmbracelet/huh/spinner"
9 )
10
11 func main() {
12 action := func() { time.Sleep(5 * time.Second) }
13 ctx, _ := context.WithTimeout(context.Background(), time.Second)
14 go action()
15 spinner.New().Context(ctx).Run()
16 fmt.Println("Done!")
17 }