UNPKG

@google/clasp

Version:

Develop Apps Script Projects locally

19 lines (18 loc) 991 B
import { Command } from 'commander'; import { getUserInfo } from '../auth/auth.js'; import { intl } from '../intl.js'; export const command = new Command('show-authorized-user') .description('Show information about the current authorizations state.') .action(async function () { const auth = this.opts().auth; if (!auth.credentials) { const msg = intl.formatMessage({ id: "ZqMsgV", defaultMessage: [{ type: 0, value: "Not logged in." }] }); console.log(msg); return; } const user = await getUserInfo(auth.credentials); const msg = intl.formatMessage({ id: "sZ9k34", defaultMessage: [{ type: 5, value: "email", options: { undefined: { value: [{ type: 0, value: "You are logged in as an unknown user." }] }, other: { value: [{ type: 0, value: "You are logged in as " }, { type: 1, value: "email" }, { type: 0, value: "." }] } } }] }, { email: user === null || user === void 0 ? void 0 : user.email, }); console.log(msg); });