Skip to content

Commit 1a01289

Browse files
authored
Merge pull request #10 from Sebbev/fix/pull-and-push-command
Add environment selection for env pull and push commands
2 parents 82aed68 + dcfb478 commit 1a01289

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
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: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,32 @@ 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
})),
7183
]
7284
const {result: {serviceType, service}} = await inquirer.prompt<any>([
7385
{
7486
choices,
75-
message: "Select a service to pull the environment variables:",
87+
message: "Select a service to push the environment variables:",
7688
name: "result",
7789
type: "list",
7890
},

0 commit comments

Comments
 (0)