MCPcopy Create free account
hub / github.com/auth0/auth0-cli / ProgressBar

Function ProgressBar

internal/ansi/progress.go:10–29  ·  view source on GitHub ↗

ProgressBar will display progress indication for the given items.

(desc string, items []T, fn func(int, T) error)

Source from the content-addressed store, hash-verified

8
9// ProgressBar will display progress indication for the given items.
10func ProgressBar[T comparable](desc string, items []T, fn func(int, T) error) error {
11 switch len(items) {
12 case 0:
13 return nil
14 case 1:
15 return Spinner(desc, func() error {
16 return fn(1, items[0])
17 })
18 default:
19 bar := progressbar.Default(int64(len(items)), desc)
20 var errs []error
21 for i, item := range items {
22 _ = bar.Add(1)
23 if err := fn(i, item); err != nil {
24 errs = append(errs, err)
25 }
26 }
27 return errors.Join(errs...)
28 }
29}

Callers 14

deleteNetworkACLCmdFunction · 0.92
deleteUserCmdFunction · 0.92
deleteActionCmdFunction · 0.92
deleteEventStreamCmdFunction · 0.92
deleteCustomDomainCmdFunction · 0.92
deleteAppCmdFunction · 0.92
deleteRuleCmdFunction · 0.92
deleteAPICmdFunction · 0.92
deleteUserBlocksCmdFunction · 0.92
deleteOrganizationCmdFunction · 0.92

Calls 2

SpinnerFunction · 0.85
DefaultMethod · 0.65

Tested by

no test coverage detected