"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loginHandler = loginHandler;
const update_manager_1 = require("../../nx-cloud/update-manager");
const get_cloud_options_1 = require("../../nx-cloud/utilities/get-cloud-options");
const params_1 = require("../../utils/params");
function loginHandler(args) {
    if (args.nxCloudUrl) {
        process.env.NX_CLOUD_API = args.nxCloudUrl;
    }
    return (0, params_1.handleErrors)(args.verbose, async () => {
        const nxCloudClient = (await (0, update_manager_1.verifyOrUpdateNxCloudClient)((0, get_cloud_options_1.getCloudOptions)()))
            .nxCloudClient;
        await nxCloudClient.commands.login();
    });
}
