Skip to content

Commit d7ef052

Browse files
committed
feat: Add environment selection for env pull and push commands
1 parent 82aed68 commit d7ef052

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

src/commands/env/pull.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,24 @@ export default class EnvPull extends Command {
5353
const projectId = project.projectId;
5454
const projectSelected = await getProject(projectId, auth, this);
5555

56+
const {environment} = await inquirer.prompt<any>([
57+
{
58+
choices: projectSelected.environments.map((environment: any) => ({
59+
name: environment.name,
60+
value: environment,
61+
})),
62+
message: "Select the environment:",
63+
name: "environment",
64+
type: "list",
65+
},
66+
]);
67+
5668
const choices = [
57-
...projectSelected.applications.map((app: any) => ({
69+
...environment.applications.map((app: any) => ({
5870
name: `${app.name} (Application)`,
5971
value: app.env,
6072
})),
61-
...projectSelected.compose.map((compose: any) => ({
73+
...environment.compose.map((compose: any) => ({
6274
name: `${compose.name} (Compose)`,
6375
value: compose.env,
6476
})),

src/commands/env/push.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,24 @@ export default class EnvPush extends Command {
5959
const projectId = project.projectId;
6060
const projectSelected = await getProject(projectId, auth, this);
6161

62+
const {environment} = await inquirer.prompt<any>([
63+
{
64+
choices: projectSelected.environments.map((environment: any) => ({
65+
name: environment.name,
66+
value: environment,
67+
})),
68+
message: "Select the environment:",
69+
name: "environment",
70+
type: "list",
71+
},
72+
]);
73+
6274
const choices = [
63-
...projectSelected.applications.map((app: any) => ({
75+
...environment.applications.map((app: any) => ({
6476
name: `${app.name} (Application)`,
6577
value: {serviceType: 'app', service: app},
6678
})),
67-
...projectSelected.compose.map((compose: any) => ({
79+
...environment.compose.map((compose: any) => ({
6880
name: `${compose.name} (Compose)`,
6981
value: {serviceType: 'compose', service: compose}
7082
})),

0 commit comments

Comments
 (0)