@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
38 lines (37 loc) • 1.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.commandMongoGetShell = void 0;
const defineCommand_1 = require("../../core/defineCommand");
const projects_1 = require("../../utils/projects");
const ensureCluster_1 = require("../../apps/cli/commands/project/utils/ensureCluster");
const utils_1 = require("../../apps/cli/commands/mongodb/utils");
const autocompletions_1 = require("../../apps/cli/commands/project/utils/autocompletions");
const availability_1 = require("../availability");
exports.commandMongoGetShell = (0, defineCommand_1.defineCommand)({
name: "project mongo get-shell",
description: "get a shell to a mongodb in the environment",
group: "mongodb",
isAvailable: (0, availability_1.hasDeployType)("kubernetes"),
inputs: {
envComponent: {
type: "string",
message: "environment:component",
positional: true,
choices: async () => (0, autocompletions_1.envAndComponents)()
},
podName: {
type: "string",
message: "Which pod? 🤔",
choices: async ctx => (0, utils_1.getProjectMongodbAllPodsSortedWithLabel)(await ctx.get("envComponent"))
}
},
execute: async ctx => {
const envComponent = await ctx.get("envComponent");
await (0, ensureCluster_1.ensureCluster)(ctx, envComponent);
const namespace = await (0, projects_1.getProjectNamespace)(envComponent);
const podName = await ctx.get("podName");
return (0, utils_1.getMongodbShell)(namespace, podName);
}
});