MCPcopy
hub / github.com/hasura/graphql-engine / newProgressBar

Function newProgressBar

cli/migrate/migrate.go:57–76  ·  view source on GitHub ↗
(str string, w io.Writer, pbLogs bool)

Source from the content-addressed store, hash-verified

55)
56
57func newProgressBar(str string, w io.Writer, pbLogs bool) *pb.ProgressBar {
58 // Default behaviour in non-interactive mode
59 if !pbLogs && !term.IsTerminal(int(os.Stdout.Fd())) {
60 return nil
61 }
62 // bar template configuration
63 str = fmt.Sprintf(`"%v: "`, str)
64 var barTemplateConfiguration string = fmt.Sprintf(`{{ cyan %s }} {{ counters .}} {{ bar . "[" "=" ">" "." "]"}} {{percent .}}`, str)
65 bar := pb.ProgressBarTemplate(barTemplateConfiguration).New(0)
66 bar.SetRefreshRate(time.Millisecond)
67 // non-interactive mode with progressbar-logs flag
68 if pbLogs && !term.IsTerminal(int(os.Stdout.Fd())) {
69 bar.Set(pb.Terminal, true)
70 }
71 bar.Set(pb.CleanOnFinish, true)
72 if w != nil {
73 bar.SetWriter(w)
74 }
75 return bar
76}
77
78func startProgressBar(bar *pb.ProgressBar) {
79 if bar != nil {

Callers 5

MigrateMethod · 0.85
StepsMethod · 0.85
UpMethod · 0.85
DownMethod · 0.85
GotoVersionMethod · 0.85

Calls 1

SetMethod · 0.65

Tested by

no test coverage detected