File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,7 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd
166166github.com/mattn/go-isatty v0.0.10 /go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84 =
167167github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY =
168168github.com/mattn/go-isatty v0.0.12 /go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU =
169+ github.com/mattn/go-runewidth v0.0.6 h1:V2iyH+aX9C5fsYCpK60U8BYIvmhqxuOL3JZcqc1NB7k =
169170github.com/mattn/go-runewidth v0.0.6 /go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI =
170171github.com/mattn/go-tty v0.0.3 h1:5OfyWorkyO7xP52Mq7tB36ajHDG5OHrmBGIS/DtakQI =
171172github.com/mattn/go-tty v0.0.3 /go.mod h1:ihxohKRERHTVzN+aSVRwACLCeqIoZAWpoICkkvrWyR0 =
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import (
1111 "strings"
1212
1313 "github.com/mattn/go-tty"
14+ "github.com/mattn/go-tty/ttyutil"
1415 batchv1 "k8s.io/api/batch/v1"
1516 batchv1beta1 "k8s.io/api/batch/v1beta1"
1617 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -205,9 +206,11 @@ func createJob(job *batchv1.Job) error {
205206 return err
206207 }
207208
208- fmt .Printf ("Can you apply it?[y/N]\n " )
209- var answer string
210- fmt .Scan (& answer )
209+ fmt .Fprint (tty .Output (), "Can you apply it? [y/N]\n " )
210+ answer , err := ttyutil .ReadLine (tty )
211+ if err != nil {
212+ return err
213+ }
211214 answer = strings .TrimSpace (answer )
212215 if answer != "Y" && answer != "y" {
213216 fmt .Println ("canceled" )
You can’t perform that action at this time.
0 commit comments