Skip to content

Commit

Permalink
Fix small errors with clasp clone and clasp logs (google#194)
Browse files Browse the repository at this point in the history
* Fix small errors with clasp clone and clasp logs

Signed-off-by: campionfellin <[email protected]>

* Fix clasp clone small error

Signed-off-by: campionfellin <[email protected]>
  • Loading branch information
campionfellin authored and grant committed May 30, 2018
1 parent 60393ef commit 4bc1e32
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,19 +300,19 @@ 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',
name : 'scriptId',
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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4bc1e32

Please sign in to comment.