zcatalyst-cli
Version:
Command Line Tool for CATALYST
44 lines (43 loc) • 2.21 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const error_1 = __importDefault(require("../../error"));
const command_1 = __importDefault(require("../../internal/command"));
const prompt_1 = __importDefault(require("../../prompt"));
const config_1 = require("../../util_modules/config");
exports.default = new command_1.default('appsail:unlink [appsail_name]')
.description('Unlink an AppSail from the current project folder')
.needs('auth')
.needs('config')
.needs('rc')
.ci(false)
.action((appSailName) => __awaiter(void 0, void 0, void 0, function* () {
const allAppSails = config_1.appSailConfig.raw(false) || [];
if (allAppSails.length === 0) {
throw new error_1.default('No AppSails found linked to this project directory', {
exit: 1
});
}
if (!appSailName) {
const nameQ = yield prompt_1.default.ask(prompt_1.default.question('name', 'Please select an AppSail to unlink', {
type: 'list',
choices: allAppSails.map((sail) => prompt_1.default.choice(sail.name, { value: sail.name, short: sail.name }))
}));
if (!nameQ.name) {
throw new error_1.default('Unable to get the AppSail name from user', { exit: 2 });
}
appSailName = nameQ.name;
}
yield config_1.appSailConfig.unlinkAppSail(appSailName);
}));