genezio
Version:
Command line utility to interact with Genezio infrastructure.
27 lines (26 loc) • 1.13 kB
JavaScript
import inquirer from "inquirer";
import { interruptLocalProcesses } from "../utils/localInterrupt.js";
import { doAdaptiveLogAction, log } from "../utils/logging.js";
import { YamlConfigurationIOController } from "../projectConfiguration/yaml/v2.js";
import { exit } from "process";
import { cloneCommand } from "./clone.js";
export async function pullCommand(stage) {
await interruptLocalProcesses();
const configIOController = new YamlConfigurationIOController("./genezio.yaml", {
stage: stage,
});
const configuration = await configIOController.read();
const { confirmPull } = await inquirer.prompt([
{
type: "confirm",
name: "confirmPull",
message: `Are you sure you want to pull the latest changes from the cloud? All local changes will be lost.`,
default: false,
},
]);
if (!confirmPull) {
log.info("Pull operation cancelled.");
exit(0);
}
await doAdaptiveLogAction("Pulling the latest changes from the cloud...", async () => cloneCommand(configuration.name, configuration.region, stage, "."));
}