"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkService = void 0;
const chalk_1 = __importDefault(require("chalk"));
const logger_1 = require("../utils/logger");
const start_1 = require("./start");
const scheduler_1 = require("../utils/scheduler");
exports.checkService = (cmd) => __awaiter(void 0, void 0, void 0, function* () {
    const logger = new logger_1.Logger();
    const { graph } = yield start_1.init(logger, new scheduler_1.RecompilationScheduler(logger));
    if (!graph.getServices().some((s) => s.getName() === cmd)) {
        console.info(`\n${chalk_1.default.red('✖')} Unknown service`, cmd);
        process.exit(1);
    }
    console.info(`\n${chalk_1.default.green('✔')} Valid service`, cmd);
    process.exit(0);
});
//# sourceMappingURL=check-service.js.map