"use strict";
/*
 * @adonisjs/repl
 *
 * (c) Harminder Virk <virk@adonisjs.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
Object.defineProperty(exports, "__esModule", { value: true });
const standalone_1 = require("@adonisjs/core/build/standalone");
class ReplCommand extends standalone_1.BaseCommand {
    async run() {
        this.application.container.withBindings(['Adonis/Core/Route'], (Route) => {
            Route.commit();
        });
        this.application.container.use('Adonis/Addons/Repl').start();
        /**
         * Gracefully shutdown the application
         */
        this.application.container.use('Adonis/Addons/Repl').server.on('exit', async () => {
            await this.application.shutdown();
        });
    }
}
exports.default = ReplCommand;
ReplCommand.commandName = 'repl';
ReplCommand.description = 'Start a new REPL session';
ReplCommand.settings = {
    loadApp: true,
    environment: 'repl',
    stayAlive: true,
};
