import * as os from 'node:os';
import constants from './constants.js';
const { ANSI_CODES } = constants;
import OutputManager from './outputManager.js';
export default class StatusManager {
    static _EOL_STR = os.EOL;
    static commandText;
    static taskText;
    static failCommand() {
        this.failTask();
        if (this.commandText) {
            OutputManager.newline(process.stderr);
            OutputManager.error(OutputManager.bold(this.commandText + " failed"));
            this.taskText = null;
        }
    }
    static failTask() {
        if (this.taskText) {
            OutputManager.error(OutputManager.bold(this.taskText + " failed"));
            OutputManager.newline();
            this.taskText = null;
        }
    }
    static finishCommand(description) {
        this.finishTask();
        OutputManager.newline();
        OutputManager.info(OutputManager.bold(`${ANSI_CODES.GREEN}${description || this.commandText} completed successfully.`));
    }
    static finishTask() {
        if (this.taskText) {
            OutputManager.info(OutputManager.bold(this.taskText + " completed"));
            OutputManager.newline();
            this.taskText = null;
        }
    }
    static startCommand(commandText) {
        this.commandText = commandText;
        this.finishTask();
        OutputManager.newline();
        OutputManager.info(OutputManager.bold(`${ANSI_CODES.GREEN}${this.commandText}...`));
        OutputManager.newline();
    }
    static startTask(message) {
        if (this.taskText) {
            this.finishTask();
        }
        OutputManager.newline();
        this.taskText = message;
        OutputManager.info(OutputManager.bold(this.taskText + "..."));
    }
}
