MCPcopy Index your code
hub / github.com/jetify-com/devbox / Status

Function Status

internal/setup/setup.go:97–113  ·  view source on GitHub ↗

Status returns the status of a setup task.

(ctx context.Context, key string, task Task)

Source from the content-addressed store, hash-verified

95
96// Status returns the status of a setup task.
97func Status(ctx context.Context, key string, task Task) TaskStatus {
98 defer debug.FunctionTimer().End()
99 state := loadState(key)
100 switch {
101 case isSudo(key):
102 return TaskSudoing
103 case state.ConfirmPrompt.Asked && !state.ConfirmPrompt.Allowed:
104 return TaskUserRefused
105 case task.NeedsRun(ctx, state.LastRun):
106 return TaskNeedsRun
107 case state.LastRun.Error == "":
108 return TaskDone
109 case state.LastRun.Error != "":
110 return TaskError
111 }
112 panic("setup.Status switch isn't exhaustive")
113}
114
115// Run runs a setup task and stores its state under a given key. Keys are
116// namespaced by user. It only calls the task's Run method when NeedsRun returns

Callers 1

IsConfiguredFunction · 0.92

Calls 5

FunctionTimerFunction · 0.92
loadStateFunction · 0.85
isSudoFunction · 0.85
EndMethod · 0.80
NeedsRunMethod · 0.65

Tested by

no test coverage detected