@@ -16,6 +16,7 @@ import { ResourceDiscovery } from "../resourceDiscovery.js";
16
16
import { GitIgnore } from "../gitignore.js" ;
17
17
import { VsCode } from "../vsCode.js" ;
18
18
import { Logger } from "../logger.js" ;
19
+ import { Configuration } from "../configuration.js" ;
19
20
20
21
const configFileName = path . resolve ( configFileDefaultName ) ;
21
22
@@ -205,6 +206,10 @@ export async function getConfigFromWizard({
205
206
] ) ;
206
207
207
208
if ( answersFilter . function === "Pick one" ) {
209
+ // I need to use congiration settings I accquired so far to get the list of lambdas
210
+ const configTemp = getConfigFromAnswers ( answers ) ;
211
+ Configuration . setConfig ( configTemp as any ) ; // not complete config
212
+
208
213
lambdasList = await ResourceDiscovery . getLambdas (
209
214
getConfigFromAnswers ( answers ) as LldConfig
210
215
) ;
@@ -295,10 +300,17 @@ export async function getConfigFromWizard({
295
300
const config = getConfigFromAnswers ( answers ) ;
296
301
297
302
if ( save ) {
298
- // save to file that looks like this:
299
- Logger . log ( `Saving to config file ${ configFileName } ` ) ;
303
+ await saveConfiguration ( config ) ;
304
+ }
305
+
306
+ return config ;
307
+ }
300
308
301
- const configContent = `
309
+ async function saveConfiguration ( config : LldConfigCliArgs ) {
310
+ Logger . log ( `Saving to config file ${ configFileName } ` ) ;
311
+
312
+ // save to file that looks like this:
313
+ const configContent = `
302
314
import { type LldConfigTs } from "lambda-live-debugger";
303
315
304
316
export default {
@@ -321,17 +333,14 @@ export default {
321
333
} satisfies LldConfigTs;
322
334
` ;
323
335
324
- // remove lines that contains undefined or ""
325
- const configContentCleaned = configContent
326
- . trim ( )
327
- . split ( "\n" )
328
- . filter ( ( l ) => ! l . includes ( "undefined" ) && ! l . includes ( '""' ) )
329
- . join ( "\n" ) ;
330
-
331
- await fs . writeFile ( configFileName , configContentCleaned ) ;
332
- }
336
+ // remove lines that contains undefined or ""
337
+ const configContentCleaned = configContent
338
+ . trim ( )
339
+ . split ( "\n" )
340
+ . filter ( ( l ) => ! l . includes ( "undefined" ) && ! l . includes ( '""' ) )
341
+ . join ( "\n" ) ;
333
342
334
- return config ;
343
+ await fs . writeFile ( configFileName , configContentCleaned ) ;
335
344
}
336
345
337
346
function getConfigFromAnswers ( answers : any ) : LldConfigCliArgs {
0 commit comments