2019-02-06 08:04:12 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2022-03-21 14:48:03 +00:00
|
|
|
//go:build ignore
|
2019-02-06 08:04:12 +00:00
|
|
|
// +build ignore
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
"strings"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"golang.org/x/sync/errgroup"
|
|
|
|
|
2019-11-14 19:46:15 +00:00
|
|
|
"storj.io/storj/private/cui"
|
2019-02-06 08:04:12 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
screen, err := cui.NewScreen()
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
var group errgroup.Group
|
|
|
|
group.Go(func() error {
|
|
|
|
defer cancel()
|
|
|
|
return screen.Run()
|
|
|
|
})
|
|
|
|
|
|
|
|
counter := 0
|
|
|
|
for ctx.Err() == nil {
|
|
|
|
width, _ := screen.Size()
|
|
|
|
fmt.Fprintf(screen, "%2d\n", counter)
|
|
|
|
fmt.Fprintf(screen, "%s\n", strings.Repeat("=", width))
|
|
|
|
screen.Flush()
|
|
|
|
|
|
|
|
counter++
|
|
|
|
time.Sleep(time.Second)
|
|
|
|
}
|
|
|
|
if err := screen.Close(); err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := group.Wait(); err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
}
|
|
|
|
}
|