import { Command } from '@oclif/core';
import Conf from "conf";
import log from "../util/log.js";
const config = new Conf({ projectName: "campfire" });
export default class List extends Command {
    static description = 'List all active Campfire preview environments';
    async run() {
        const APP_NAMES = JSON.parse(config.get("APP_NAMES", "[]"));
        const NAMES_FORMATTED = APP_NAMES
            .map((name) => "- " + name)
            .join("\n");
        if (APP_NAMES.length === 0) {
            log.info("There are currently 0 applications registered with Campfire.");
        }
        else {
            log.info(`Current applications registered with Campfire:\n${NAMES_FORMATTED}`);
        }
    }
}
