UNPKG

@google/clasp

Version:

Develop Apps Script Projects locally

20 lines (19 loc) 1.18 kB
import { Command } from 'commander'; import { intl } from '../intl.js'; import { withSpinner } from './utils.js'; export const command = new Command('pull') .description('Fetch a remote project') .option('--versionNumber <version>', 'The version number of the project to retrieve.') .action(async function (options) { const clasp = this.opts().clasp; const versionNumber = options.versionNumber; const spinnerMsg = intl.formatMessage({ id: "jilcJH", defaultMessage: [{ type: 0, value: "Pulling files..." }] }); const files = await withSpinner(spinnerMsg, async () => { return await clasp.files.pull(versionNumber); }); files.forEach(f => console.log(`└─ ${f.localPath}`)); const successMessage = intl.formatMessage({ id: "4mRAfN", defaultMessage: [{ type: 0, value: "Pulled " }, { type: 6, value: "count", options: { "=0": { value: [{ type: 0, value: "no files." }] }, one: { value: [{ type: 0, value: "one file." }] }, other: { value: [{ type: 7 }, { type: 0, value: " files" }] } }, offset: 0, pluralType: "cardinal" }, { type: 0, value: "." }] }, { count: files.length, }); console.log(successMessage); });