(name, msg string, actionOpts *action.ActionsOpts)
| 108 | } |
| 109 | |
| 110 | func 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 |
| 128 | func confirmationPrompt(msg string) bool { |
no test coverage detected