| 139 | } |
| 140 | |
| 141 | func PromptMissing(opts *CreateOptions) error { |
| 142 | if opts.Name.Value == "" { |
| 143 | if err := opts.Ask(&survey.Input{ |
| 144 | Message: "Name", |
| 145 | Help: "A short, memorable, unique name for this account.", |
| 146 | }, &opts.Name.Value, survey.WithValidator(survey.ComposeValidators( |
| 147 | survey.MaxLength(200), |
| 148 | survey.MinLength(1), |
| 149 | survey.Required, |
| 150 | ))); err != nil { |
| 151 | return err |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | if opts.Description.Value == "" { |
| 156 | if err := opts.Ask(&surveyext.OctoEditor{ |
| 157 | Editor: &survey.Editor{ |
| 158 | Message: "Description", |
| 159 | Help: "A summary explaining the use of the account to other users.", |
| 160 | FileName: "*.md", |
| 161 | }, |
| 162 | Optional: true, |
| 163 | }, &opts.Description.Value); err != nil { |
| 164 | return err |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | if opts.AccessKey.Value == "" { |
| 169 | if err := opts.Ask(&survey.Input{ |
| 170 | Message: "Access Key", |
| 171 | Help: "The AWS access key to use when authenticating against Amazon Web Services.", |
| 172 | }, &opts.AccessKey.Value, survey.WithValidator(survey.ComposeValidators( |
| 173 | survey.Required, |
| 174 | ))); err != nil { |
| 175 | return err |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | if opts.SecretKey.Value == "" { |
| 180 | if err := opts.Ask(&survey.Password{ |
| 181 | Message: "Secret Key", |
| 182 | Help: "The AWS secret key to use when authenticating against Amazon Web Services.", |
| 183 | }, &opts.SecretKey.Value, survey.WithValidator(survey.ComposeValidators( |
| 184 | survey.Required, |
| 185 | ))); err != nil { |
| 186 | return err |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | if opts.Region.Value == "" { |
| 191 | if err := opts.Ask(&survey.Input{ |
| 192 | Message: "Region", |
| 193 | Help: "The AWS region to use for this account.", |
| 194 | }, &opts.Region.Value); err != nil { |
| 195 | return err |
| 196 | } |
| 197 | } |
| 198 | |