diff --git a/index.ts b/index.ts index 0a5c01d5..c613c848 100755 --- a/index.ts +++ b/index.ts @@ -300,10 +300,12 @@ commander q: 'mimeType="application/vnd.google-apps.script"', }); const files = data.files; - const fileIds:string[] = []; if (files.length) { - files.map((file: any) => { - fileIds.push(`${file.name}`.padEnd(20) + ` - (${file.id})`); + const fileIds = files.map((file: any) => { + return { + name: `${file.name}`.padEnd(20) + ` - (${file.id})`, + value: file.id, + }; }); await prompt([{ type : 'list', @@ -311,8 +313,6 @@ commander message : 'Clone which script? ', choices : fileIds, }]).then((answers: any) => { - answers.scriptId = answers.scriptId.substring(answers.scriptId.lastIndexOf('(') + 1, - answers.scriptId.length - 1); checkIfOnline(); spinner.setSpinnerTitle(LOG.CLONING); saveProjectId(answers.scriptId); @@ -705,7 +705,7 @@ commander }) => { await checkIfOnline(); function printLogs(entries: any[]) { - for (let i = 0; i < Math.min(50,entries.length); ++i) { + for (let i = 0; i < 50 && i < entries.length; ++i) { const { severity, timestamp, resource, textPayload, protoPayload, jsonPayload } = entries[i]; let functionName = resource.labels.function_name; functionName = functionName ? functionName.padEnd(15) : ERROR.NO_FUNCTION_NAME;