GSI - Employe Self Service Mobile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
1.0 KiB

2 months ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const clc = require("colorette");
  5. const command_1 = require("../command");
  6. const utils = require("../utils");
  7. const auth = require("../auth");
  8. const error_1 = require("../error");
  9. exports.command = new command_1.Command("login:use <email>")
  10. .description("set the default account to use for this project directory")
  11. .action((email, options) => {
  12. const allAccounts = auth.getAllAccounts();
  13. const accountExists = allAccounts.some((a) => a.user.email === email);
  14. if (!accountExists) {
  15. throw new error_1.FirebaseError(`Account ${email} does not exist, run "${clc.bold("firebase login:list")}" to see valid accounts`);
  16. }
  17. const projectDir = options.projectRoot;
  18. if (!projectDir) {
  19. throw new error_1.FirebaseError("Could not determine active Firebase project directory");
  20. }
  21. auth.setProjectAccount(projectDir, email);
  22. utils.logSuccess(`Set default account ${email} for current project directory.`);
  23. return email;
  24. });