MCPcopy Create free account
hub / github.com/algolia/cli / StartProgressIndicatorWithLabel

Method StartProgressIndicatorWithLabel

pkg/iostreams/iostreams.go:236–267  ·  view source on GitHub ↗
(label string)

Source from the content-addressed store, hash-verified

234}
235
236func (s *IOStreams) StartProgressIndicatorWithLabel(label string) {
237 if !s.progressIndicatorEnabled {
238 return
239 }
240
241 s.progressIndicatorMu.Lock()
242 defer s.progressIndicatorMu.Unlock()
243
244 if s.progressIndicator != nil {
245 if label == "" {
246 s.progressIndicator.Prefix = ""
247 } else {
248 s.progressIndicator.Prefix = label + " "
249 }
250 return
251 }
252
253 // https://github.com/briandowns/spinner#available-character-sets
254 dotStyle := spinner.CharSets[11]
255 sp := spinner.New(
256 dotStyle,
257 120*time.Millisecond,
258 spinner.WithWriter(s.ErrOut),
259 spinner.WithColor("fgCyan"),
260 )
261 if label != "" {
262 sp.Prefix = label + " "
263 }
264
265 sp.Start()
266 s.progressIndicator = sp
267}
268
269func (s *IOStreams) StopProgressIndicator() {
270 s.progressIndicatorMu.Lock()

Callers 15

RunOAuthFunction · 0.80
runOAuthFlowStepsFunction · 0.80
runCrawlerCmdFunction · 0.80
runImportCmdFunction · 0.80
runDeleteCmdFunction · 0.80
runUpdateCmdFunction · 0.80
runOperationsCmdFunction · 0.80
runListCmdFunction · 0.80
runSearchCmdFunction · 0.80
runImportCmdFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected