MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / confirmDefaultCASBackendUnset

Function confirmDefaultCASBackendUnset

app/cli/cmd/casbackend.go:110–125  ·  view source on GitHub ↗
(name, msg string, actionOpts *action.ActionsOpts)

Source from the content-addressed store, hash-verified

108}
109
110func confirmDefaultCASBackendUnset(name, msg string, actionOpts *action.ActionsOpts) (bool, error) {
111 // get existing backends
112 backends, err := action.NewCASBackendList(actionOpts).Run()
113 if err != nil {
114 return false, fmt.Errorf("failed to list existing CAS backends: %w", err)
115 }
116
117 for _, b := range backends {
118 // We are removing ourselves as the default, ask the user to confirm
119 if b.Default && b.Name == name {
120 return confirmationPrompt(msg), nil
121 }
122 }
123
124 return true, nil
125}
126
127// y/n confirmation prompt
128func confirmationPrompt(msg string) bool {

Calls 3

NewCASBackendListFunction · 0.92
confirmationPromptFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected