@zendesk/zcli
Version:
Zendesk CLI is a single command line tool for all your zendesk needs
32 lines (31 loc) • 1.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const chalk = require("chalk");
const errors_1 = require("@oclif/core/lib/errors");
const zcli_core_1 = require("@zendesk/zcli-core");
const helpMessage_1 = require("../../utils/helpMessage");
class Remove extends core_1.Command {
async run() {
const { args } = await this.parse(Remove);
const { account } = args;
const secureStore = new zcli_core_1.SecureStore();
const keytar = await secureStore.loadKeytar();
if (!keytar) {
console.log(chalk.yellow('Failed to load secure credentials store: could not remove profile.'), helpMessage_1.HELP_ENV_VARS);
return;
}
const deleted = await secureStore.deleteSecret(account);
if (!deleted)
throw new errors_1.CLIError(chalk.red(`Profile ${account} not found.`));
console.log(chalk.green(`Removed ${account} profile.`));
}
}
exports.default = Remove;
Remove.description = 'removes a profile';
Remove.args = [
{ name: 'account', required: true }
];
Remove.examples = [
'$ zcli profiles:remove [ACCOUNT]'
];