Run interactively prompts the user to confirm that it's ok to run a setup task. It only prompts the user if the task's NeedsRun method returns true. If the user refuses to run the task, then ConfirmPrompt will not ask them again. Call [Reset] to reset the task's state and re-prompt the user.
(ctx context.Context, key string, task Task, prompt string)
| 215 | // the user refuses to run the task, then ConfirmPrompt will not ask them again. |
| 216 | // Call [Reset] to reset the task's state and re-prompt the user. |
| 217 | func ConfirmRun(ctx context.Context, key string, task Task, prompt string) error { |
| 218 | if prompt == "" { |
| 219 | return taskError(key, redact.Errorf("empty confirmation prompt")) |
| 220 | } |
| 221 | return run(ctx, key, task, prompt) |
| 222 | } |
| 223 | |
| 224 | var defaultPrompt = func(msg string) (response any, err error) { |
| 225 | if isatty.IsTerminal(os.Stdin.Fd()) { |