csv2gsheets
Version:
CLI tool to convert local CSV files into Google Sheets files in a designated Google Drive folder.
27 lines • 855 B
JavaScript
// login command
import { authorize, isAuthorized, getUserEmail } from '../auth.js';
import { MESSAGES } from '../messages.js';
/**
* Authorize the user.
* If the option "status" is true, return the current user name
* or a message that the user is not logged in.
*/
export default async function login(options) {
if (options?.status) {
if (isAuthorized()) {
const email = await getUserEmail();
console.info(MESSAGES.log.youAreLoggedInAs(email ? email : 'UNKNOWN'));
}
else {
console.info(MESSAGES.log.youAreNotLoggedIn);
}
return;
}
else {
// Authorize the user
await authorize();
const email = await getUserEmail();
console.info(MESSAGES.log.youAreLoggedInAs(email ? email : 'UNKNOWN'));
}
}
//# sourceMappingURL=login.js.map