MCPcopy
hub / github.com/basecamp/once / runWithProgress

Function runWithProgress

internal/command/cli_progress.go:40–60  ·  view source on GitHub ↗
(label string, task func(docker.DeployProgressCallback) error)

Source from the content-addressed store, hash-verified

38}
39
40func runWithProgress(label string, task func(docker.DeployProgressCallback) error) error {
41 var err error
42
43 if isTerminal() {
44 p := newCLIProgress(label, task)
45 if _, runErr := tea.NewProgram(p).Run(); runErr != nil {
46 return runErr
47 }
48 err = p.err
49 } else {
50 err = task(func(docker.DeployProgress) {})
51 }
52
53 if err != nil {
54 fmt.Printf("%s: %s\n", label, lipgloss.NewStyle().Foreground(lipgloss.Red).Render("failed"))
55 } else {
56 fmt.Printf("%s: %s\n", label, lipgloss.NewStyle().Foreground(lipgloss.Green).Render("done"))
57 }
58
59 return err
60}
61
62func (m *cliProgress) Init() tea.Cmd {
63 return tea.Batch(

Callers 2

runMethod · 0.85
runMethod · 0.85

Calls 3

isTerminalFunction · 0.85
newCLIProgressFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…