func (t Terminal) Confirm(prompt string) bool {
	answer, err := t.Read(prompt)
	if err != nil {
		return false
	}
	answer = strings.ToLower(strings.TrimSpace(answer))
	return answer == "y" || answer == "yes" || answer == "sure"
}
Confirm asks the user for confirmation.
If the answer is y, yes, or sure, the used confirmed,
otherwise not.
package terminal
import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strings"
	"golang.org/x/crypto/ssh/terminal"
)
type Terminal struct {
	Input       io.Reader
	Output      io.Writer
	ErrorOutput io.Writer
}
func New(in io.Reader, out io.Writer, errorOut io.Writer) Terminal {
	return Terminal{
		Input:       in,
		Output:      out,
		ErrorOutput: errorOut,
	}
}
func (t Terminal) Read(prompt string) (string, error) {
	if prompt != "" {
		fmt.Fprintf(t.Output, "%s ", prompt)
	}
	reader := bufio.NewReader(t.Input)
	text, readErr := reader.ReadString('\n')
	if readErr != nil {
		return "", readErr
	}
	text = strings.TrimSpace(text)
	return text, nil
}