@@ -18,6 +18,7 @@ var ErrPromptFailed = errors.New("prompt failed")
1818// Confirm asks user a yes/no question. Returns true for “yes”.
1919type Confirm func (ctx context.Context , question string ) (bool , error )
2020
21+ //nolint:gocritic
2122func BuildConfirmTTY (in io.Reader , out io.Writer ) func (ctx context.Context , question string ) (bool , error ) {
2223 return func (ctx context.Context , question string ) (bool , error ) {
2324 fmt .Fprintln (out )
@@ -35,6 +36,7 @@ func BuildConfirmTTY(in io.Reader, out io.Writer) func(ctx context.Context, ques
3536 if len (s ) == 1 && strings .Contains ("YyNn" , s ) || prompt .Default != "" && len (s ) == 0 {
3637 return nil
3738 }
39+
3840 return errors .New ("invalid input" )
3941 }
4042 prompt .Validate = validate
@@ -58,14 +60,18 @@ func BuildConfirmTTY(in io.Reader, out io.Writer) func(ctx context.Context, ques
5860 }
5961
6062 if err != nil {
61- return false , fmt . Errorf ( "%w: %v" , ErrPromptFailed , err )
63+ return false , errors . Wrap ( ErrPromptFailed , err . Error () )
6264 }
6365
6466 return strings .Contains ("Yy" , input ), nil
6567 }
6668}
6769
68- func BuildConfirmNoTTY (in render.Renderer , out io.Writer , isUpdatePaused * atomic.Bool ) func (ctx context.Context , question string ) (bool , error ) {
70+ func BuildConfirmNoTTY (
71+ in render.Renderer ,
72+ out io.Writer ,
73+ isUpdatePaused * atomic.Bool ,
74+ ) func (ctx context.Context , question string ) (bool , error ) {
6975 return func (ctx context.Context , question string ) (bool , error ) {
7076 // here we pause ProgressLogManager to stop sending progress messages
7177 isUpdatePaused .Store (true )
0 commit comments