"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const chalk_1 = __importDefault(require("chalk"));
const profile_manager_1 = require("../../lib/profile-manager");
class ContextUse extends core_1.Command {
    async run() {
        const { args } = await this.parse(ContextUse);
        if (!profile_manager_1.ProfileManager.profileExists(args.name)) {
            this.error(`Profile '${args.name}' does not exist. Run 'flui context create ${args.name}' to create it.`);
        }
        profile_manager_1.ProfileManager.setActiveProfile(args.name);
        console.log(chalk_1.default.green(`✓ Switched to profile '${args.name}'`));
    }
}
ContextUse.description = 'Switch to a different profile';
ContextUse.examples = [
    '<%= config.bin %> <%= command.id %> prod',
    '<%= config.bin %> <%= command.id %> default',
];
ContextUse.args = {
    name: core_1.Args.string({
        required: true,
        description: 'Profile name to switch to',
    }),
};
exports.default = ContextUse;
