"use strict";
require("./bootstrap");
const fiber = require("fibers");
const Future = require("fibers/future");
const shelljs = require("shelljs");
shelljs.config.silent = true;
const errors_1 = require("./common/errors");
errors_1.installUncaughtExceptionListener(process.exit);
fiber(() => {
    let config = $injector.resolve("$config");
    let err = $injector.resolve("$errors");
    err.printCallStack = config.DEBUG;
    let commandDispatcher = $injector.resolve("commandDispatcher");
    let messages = $injector.resolve("$messagesService");
    messages.pathsToMessageJsonFiles = [];
    if (process.argv[2] === "completion") {
        commandDispatcher.completeCommand().wait();
    }
    else {
        commandDispatcher.dispatchCommand().wait();
    }
    $injector.dispose();
    Future.assertNoFutureLeftBehind();
}).run();
