Merge pull request #10 from Sebbev/fix/pull-and-push-command

Add environment selection for env pull and push commands
This commit is contained in:
Mauricio Siu
2025-10-05 01:26:31 -06:00
committed by GitHub
2 changed files with 29 additions and 5 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}
})),
@@ -72,7 +84,7 @@ export default class EnvPush extends Command {
const {result: {serviceType, service}} = await inquirer.prompt<any>([
{
choices,
message: "Select a service to pull the environment variables:",
message: "Select a service to push the environment variables:",
name: "result",
type: "list",
},