File tree Expand file tree Collapse file tree 3 files changed +16
-19
lines changed
Expand file tree Collapse file tree 3 files changed +16
-19
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,13 @@ func CreateCmd(h *internal.Helper) *cobra.Command {
196196 }
197197
198198 clusterName = inputModel .(ui.TextInputModel ).Inputs [clusterNameIdx ].Value ()
199+ if len (clusterName ) == 0 {
200+ return errors .New ("cluster name is required" )
201+ }
199202 rootPassword = inputModel .(ui.TextInputModel ).Inputs [passwordIdx ].Value ()
203+ if len (rootPassword ) == 0 {
204+ return errors .New ("root password is required" )
205+ }
200206 } else {
201207 // non-interactive mode, get values from flags
202208 var err error
@@ -368,22 +374,10 @@ func initialCreateInputModel() ui.TextInputModel {
368374 t .Focus ()
369375 t .PromptStyle = focusedStyle
370376 t .TextStyle = focusedStyle
371- t .Validate = func (s string ) error {
372- if len (s ) == 0 {
373- return errors .New ("cluster Name is required" )
374- }
375- return nil
376- }
377377 case passwordIdx :
378378 t .Placeholder = "Password"
379379 t .EchoMode = textinput .EchoPassword
380380 t .EchoCharacter = '•'
381- t .Validate = func (s string ) error {
382- if len (s ) == 0 {
383- return errors .New ("password is required" )
384- }
385- return nil
386- }
387381 }
388382
389383 m .Inputs [i ] = t
Original file line number Diff line number Diff line change @@ -115,8 +115,17 @@ func CreateCmd(h *internal.Helper) *cobra.Command {
115115
116116 inputs := inputModel .(ui.TextInputModel ).Inputs
117117 profileName = inputs [profileNameIdx ].Value ()
118+ if len (profileName ) == 0 {
119+ return errors .New ("profile name is required" )
120+ }
118121 publicKey = inputs [publicKeyIdx ].Value ()
122+ if len (publicKey ) == 0 {
123+ return errors .New ("public key is required" )
124+ }
119125 privateKey = inputs [privateKeyIdx ].Value ()
126+ if len (privateKey ) == 0 {
127+ return errors .New ("private key is required" )
128+ }
120129 } else {
121130 pName , err := cmd .Flags ().GetString (flag .ProfileName )
122131 if err != nil {
@@ -184,12 +193,6 @@ func initialDeletionInputModel() ui.TextInputModel {
184193 t .Focus ()
185194 t .PromptStyle = focusedStyle
186195 t .TextStyle = focusedStyle
187- t .Validate = func (s string ) error {
188- if len (s ) == 0 {
189- return errors .New ("profile name is required" )
190- }
191- return nil
192- }
193196 case publicKeyIdx :
194197 t .Placeholder = "Public Key"
195198 t .CharLimit = 128
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ func (m SpinnerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
7373}
7474
7575func (m SpinnerModel ) View () string {
76- str := color .New (color .FgYellow ).Sprintf ("%s %s. " , m .spinner .View (), color .BlueString (m .Hint )) + "\n "
76+ str := color .New (color .FgYellow ).Sprintf ("%s %s" , m .spinner .View (), color .BlueString (m .Hint )) + "\n "
7777 if m .quitting {
7878 return str + "\n "
7979 }
You can’t perform that action at this time.
0 commit comments