feat: Add environment selection for env pull and push commands

This commit is contained in:
Sebastian Vallin
2025-09-17 16:25:36 +02:00
parent 82aed684b9
commit d7ef05239f
2 changed files with 28 additions and 4 deletions

View File

@@ -53,12 +53,24 @@ export default class EnvPull extends Command {
const projectId = project.projectId;
const projectSelected = await getProject(projectId, auth, this);
const {environment} = await inquirer.prompt<any>([
{
choices: projectSelected.environments.map((environment: any) => ({
name: environment.name,
value: environment,
})),
message: "Select the environment:",
name: "environment",
type: "list",
},
]);
const choices = [
...projectSelected.applications.map((app: any) => ({
...environment.applications.map((app: any) => ({
name: `${app.name} (Application)`,
value: app.env,
})),
...projectSelected.compose.map((compose: any) => ({
...environment.compose.map((compose: any) => ({
name: `${compose.name} (Compose)`,
value: compose.env,
})),

View File

@@ -59,12 +59,24 @@ export default class EnvPush extends Command {
const projectId = project.projectId;
const projectSelected = await getProject(projectId, auth, this);
const {environment} = await inquirer.prompt<any>([
{
choices: projectSelected.environments.map((environment: any) => ({
name: environment.name,
value: environment,
})),
message: "Select the environment:",
name: "environment",
type: "list",
},
]);
const choices = [
...projectSelected.applications.map((app: any) => ({
...environment.applications.map((app: any) => ({
name: `${app.name} (Application)`,
value: {serviceType: 'app', service: app},
})),
...projectSelected.compose.map((compose: any) => ({
...environment.compose.map((compose: any) => ({
name: `${compose.name} (Compose)`,
value: {serviceType: 'compose', service: compose}
})),