@@ -170,122 +170,122 @@ export let inputCli = async function (
170170 resource = ""
171171) {
172172 let res :AnyObject = { } ;
173- for ( let i = 0 ; i < subObj . length ; i ++ ) {
174- if ( subObj [ i ] . value === "object" ) {
175- let resp = await inputCli ( obj , obj [ subObj [ i ] . key ] , choiceOption ) ;
176- res = { ...res , [ subObj [ i ] . key ] : resp } ;
177- } else if ( subObj [ i ] . value === "choice" ) {
178- let choice = obj . choices [ subObj [ i ] . key ] ;
179- let r = await inputType ( subObj [ i ] . key , choice , subObj [ i ] . message ) ;
180- res [ `${ subObj [ i ] . key } ` ] = r ;
181- } else if ( subObj [ i ] . value === "choiceOption" ) {
182- let choice = obj . choiceOption [ subObj [ i ] . key ] ;
183- let p = await inputType ( subObj [ i ] . key , choice , subObj [ i ] . message ) ;
173+ for ( let sobj of subObj ) {
174+ if ( sobj . value === "object" ) {
175+ let resp = await inputCli ( obj , obj [ sobj . key ] , choiceOption ) ;
176+ res = { ...res , [ sobj . key ] : resp } ;
177+ } else if ( sobj . value === "choice" ) {
178+ let choice = obj . choices [ sobj . key ] ;
179+ let r = await inputType ( sobj . key , choice , sobj . message ) ;
180+ res [ `${ sobj . key } ` ] = r ;
181+ } else if ( sobj . value === "choiceOption" ) {
182+ let choice = obj . choiceOption [ sobj . key ] ;
183+ let p = await inputType ( sobj . key , choice , sobj . message ) ;
184184
185185 if ( p === "String" ) {
186186 let r = await inquirer . prompt ( [
187187 {
188188 type : "input" ,
189189 message : `${ choiceOption === "" ? "" : choiceOption + "->" } ${
190- subObj [ i ] . message
190+ sobj . message
191191 } `,
192- name : `${ subObj [ i ] . key } ` ,
192+ name : `${ sobj . key } ` ,
193193 } ,
194194 ] ) ;
195195 res = { ...res , ...r } ;
196196 } else {
197- let r = await inputCli ( obj , obj [ p ] , subObj [ i ] . key ) ;
197+ let r = await inputCli ( obj , obj [ p ] , sobj . key ) ;
198198 let temp :AnyObject = { } ;
199199 temp [ `${ p } ` ] = { r } ;
200200
201- res [ `${ subObj [ i ] . key } ` ] = { ...temp } ;
201+ res [ `${ sobj . key } ` ] = { ...temp } ;
202202 }
203- } else if ( subObj [ i ] . value === "list" ) {
204- let r = await inputNumber ( subObj [ i ] . key , subObj [ i ] . message ) ;
203+ } else if ( sobj . value === "list" ) {
204+ let r = await inputNumber ( sobj . key , sobj . message ) ;
205205 let codeUriArr : any = [ ] ;
206206 for ( let j = 0 ; j < r ; j ++ ) {
207207 let r = await inquirer . prompt ( [
208208 {
209209 type : "input" ,
210210 message : `${ choiceOption === "" ? "" : choiceOption + "->" } ${
211- subObj [ i ] . message
211+ sobj . message
212212 } `,
213- name : `${ subObj [ i ] . key } ` ,
213+ name : `${ sobj . key } ` ,
214214 } ,
215215 ] ) ;
216- codeUriArr . push ( r [ `${ subObj [ i ] . key } ` ] ) ;
216+ codeUriArr . push ( r [ `${ sobj . key } ` ] ) ;
217217 }
218- res [ `${ subObj [ i ] . key } ` ] = codeUriArr ;
219- } else if ( subObj [ i ] . value === "Boolean" ) {
218+ res [ `${ sobj . key } ` ] = codeUriArr ;
219+ } else if ( sobj . value === "Boolean" ) {
220220 let r = await inquirer . prompt ( [
221221 {
222222 type : "confirm" ,
223- name : `${ subObj [ i ] . key } ` ,
224- message : `DO you want ${ subObj [ i ] . message } property to be enabled` ,
223+ name : `${ sobj . key } ` ,
224+ message : `DO you want ${ sobj . message } property to be enabled` ,
225225 } ,
226226 ] ) ;
227227
228- res [ `${ subObj [ i ] . key } ` ] = r ;
229- } else if ( subObj [ i ] . value === "objectList" ) {
230- let p = await inputNumber ( subObj [ i ] . key , subObj [ i ] . message ) ;
228+ res [ `${ sobj . key } ` ] = r ;
229+ } else if ( sobj . value === "objectList" ) {
230+ let p = await inputNumber ( sobj . key , sobj . message ) ;
231231 let objListArr : any = [ ] ;
232232 while ( p -- !== 0 ) {
233- let temp = await inputCli ( obj , obj [ subObj [ i ] . key ] , subObj [ i ] . key ) ;
233+ let temp = await inputCli ( obj , obj [ sobj . key ] , sobj . key ) ;
234234 objListArr . push ( temp ) ;
235235 }
236236
237- res [ `${ subObj [ i ] . key } ` ] = objListArr ;
238- } else if ( subObj [ i ] . value === "multipleChoice" ) {
239- if ( subObj [ i ] . key === "Action" ) {
237+ res [ `${ sobj . key } ` ] = objListArr ;
238+ } else if ( sobj . value === "multipleChoice" ) {
239+ if ( sobj . key === "Action" ) {
240240 let choice = init . stackNames . map ( ( { key, value } ) => value ) ;
241241 choice = choice . filter ( ( item , pos ) => choice . indexOf ( item ) == pos ) ;
242- let p = await inputType ( subObj [ i ] . key , choice , subObj [ i ] . message ) ;
242+ let p = await inputType ( sobj . key , choice , sobj . message ) ;
243243 choice = obj . choices [ p ] ;
244244
245245 let r = await multichoice ( p , choice ) ;
246246
247247 let actionArr = r [ p ] . map ( ( ele ) => `${ p } :${ ele } ` ) ;
248248 res = { Action : actionArr } ;
249249 } else {
250- let choice = obj . choices [ subObj [ i ] . key ] ;
251- let r = await multichoice ( subObj [ i ] . key , choice , ) ;
250+ let choice = obj . choices [ sobj . key ] ;
251+ let r = await multichoice ( sobj . key , choice , ) ;
252252 res = { ...res , ...r } ;
253253 }
254- } else if ( subObj [ i ] . value === "choiceReference" ) {
254+ } else if ( sobj . value === "choiceReference" ) {
255255 let choice = init . stackNames . map ( ( { key, value } ) => value ) ;
256256 choice = choice . filter ( ( item , pos ) => choice . indexOf ( item ) == pos ) ;
257257 if (
258- ( subObj [ i ] . key === "resource" || subObj [ i ] . key === "Ref" ) &&
258+ ( sobj . key === "resource" || sobj . key === "Ref" ) &&
259259 choice . length > 0
260260 ) {
261- let p = await inputType ( subObj [ i ] . key , choice ) ;
261+ let p = await inputType ( sobj . key , choice ) ;
262262 let choiceNames = init . stackNames
263263 . filter ( ( { key, value } ) => value === p )
264264 . map ( ( { key, value } ) => key ) ;
265265 let r = await inputType ( p , choiceNames ) ;
266266
267- res [ `${ subObj [ i ] . key } ` ] = r ;
268- } else if ( subObj [ i ] . key === "role" && choice . indexOf ( "iamrole" ) !== - 1 ) {
267+ res [ `${ sobj . key } ` ] = r ;
268+ } else if ( sobj . key === "role" && choice . indexOf ( "iamrole" ) !== - 1 ) {
269269 let choiceNames = init . stackNames
270270 . filter ( ( { key, value } ) => value === "iamrole" )
271271 . map ( ( { key, value } ) => key ) ;
272- res [ subObj [ i ] . key ] = choiceNames [ 0 ] ;
272+ res [ sobj . key ] = choiceNames [ 0 ] ;
273273 } else {
274- let name = await inputString ( "name" , "" , `${ subObj [ i ] . message } -->Name` ) ;
274+ let name = await inputString ( "name" , "" , `${ sobj . message } -->Name` ) ;
275275
276276 let temp = name ;
277277
278- res [ `${ subObj [ i ] . key } ` ] = temp . name ;
278+ res [ `${ sobj . key } ` ] = temp . name ;
279279 }
280- } else if ( subObj [ i ] . value === "choiceList" ) {
281- let choice = obj . choices [ subObj [ i ] . key ] ;
280+ } else if ( sobj . value === "choiceList" ) {
281+ let choice = obj . choices [ sobj . key ] ;
282282
283- let p = await inputType ( subObj [ i ] . key , choice , subObj [ i ] . message ) ;
283+ let p = await inputType ( sobj . key , choice , sobj . message ) ;
284284
285285 let s = { } ;
286286
287287 if ( p ) {
288- let r = await inputCli ( obj , obj [ p ] , subObj [ i ] . key ) ;
288+ let r = await inputCli ( obj , obj [ p ] , sobj . key ) ;
289289 let temp :AnyObject = { } ;
290290 if ( p === "GetAtt" ) {
291291 let FnGetAtt : any = [ ] ;
@@ -298,28 +298,28 @@ export let inputCli = async function (
298298 temp [ `${ p } ` ] = { ...r } ;
299299 }
300300
301- res [ `${ subObj [ i ] . key } ` ] = { ...temp } ;
301+ res [ `${ sobj . key } ` ] = { ...temp } ;
302302 }
303- } else if ( subObj [ i ] . key === 'accesskey' || subObj [ i ] . key === 'secretkey' ) {
303+ } else if ( sobj . key === 'accesskey' || sobj . key === 'secretkey' ) {
304304 let r = await inquirer . prompt ( [
305305 {
306306 type : 'password' ,
307307 message : `${ choiceOption === "" ? "" : choiceOption + "->" } ${
308- subObj [ i ] . message
308+ sobj . message
309309 } `,
310- name : `${ subObj [ i ] . key } ` ,
310+ name : `${ sobj . key } ` ,
311311 } ,
312312 ] ) ;
313313 res = { ...res , ...r } ;
314- accesskey = r [ subObj [ i ] . key ] ;
314+ accesskey = r [ sobj . key ] ;
315315 } else {
316316 let r = await inquirer . prompt ( [
317317 {
318318 type : "input" ,
319319 message : `${ choiceOption === "" ? "" : choiceOption + "->" } ${
320- subObj [ i ] . message
320+ sobj . message
321321 } `,
322- name : `${ subObj [ i ] . key } ` ,
322+ name : `${ sobj . key } ` ,
323323 } ,
324324 ] ) ;
325325 res = { ...res , ...r } ;
@@ -427,10 +427,10 @@ export let appType = async function(message:string=""){
427427 choices :cliConfig . app . choices . type
428428 } ] )
429429 let stackModule = Stack . ModuleDescription ;
430- for ( let i = 0 ; i < stackModule . length ; i ++ ) {
431- if ( stackModule [ i ] . value === r [ "app_Type" ] ) {
432- return stackModule [ i ] . key ;
433- ; }
430+ for ( let smodule of stackModule ) {
431+ if ( smodule . value === r [ "app_Type" ] ) {
432+ return smodule . key ;
433+ }
434434 }
435435}
436436export let moreStack = async function ( message :string ) {
0 commit comments