@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
43 lines (42 loc) • 1.49 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.commandDeleteProject = void 0;
const child_process_promise_1 = require("child-process-promise");
const defineCommand_1 = require("../../../core/defineCommand");
const projects_1 = require("../../../utils/projects");
const autocompletions_1 = require("../../../apps/cli/commands/project/utils/autocompletions");
const availability_1 = require("../../availability");
exports.commandDeleteProject = (0, defineCommand_1.defineCommand)({
name: "project k8s delete",
description: "deletes a environment of a project (it deletes the namespace)",
group: "project",
isAvailable: (0, availability_1.hasDeployType)("kubernetes"),
inputs: {
envComponent: {
type: "string",
message: "environment:component",
positional: true,
choices: async () => (0, autocompletions_1.envAndComponents)()
}
},
execute: async ctx => {
const envComponent = await ctx.get("envComponent");
const namespace = await (0, projects_1.getProjectNamespace)(envComponent);
const shouldContinue = await ctx.confirm("This will delete the namespace. All data will be lost. Continue? 🤔 ");
if (!shouldContinue) {
return;
}
const fullCommand = `kubectl delete namespace ${namespace}`;
const {
stdout
} = await (0, child_process_promise_1.exec)(fullCommand, {
env: {
...process.env,
DEBUG: ""
}
});
ctx.log(stdout);
}
});