UNPKG

@syntest/core

Version:

The common core of the SynTest Framework

74 lines 2.46 kB
"use strict"; /* * Copyright 2020-2021 Delft University of Technology and SynTest contributors * * This file is part of SynTest Framework - SynTest Core. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.CommandLineInterface = void 0; const UserInterface_1 = require("./UserInterface"); const logger_1 = require("../util/logger"); const cliProgress = require("cli-progress"); const chalk = require("chalk"); const figlet = require("figlet"); class CommandLineInterface extends UserInterface_1.UserInterface { constructor(silent = false, verbose = false) { super(silent, verbose); } asciiArt(text) { return chalk.yellow(figlet.textSync(text, { horizontalLayout: "full" })); } startProgressBar() { this.showProgressBar = true; this.bar = new cliProgress.SingleBar({ format: "Coverage: {bar} {percentage}% | Remaining budget: {budget}%", barCompleteChar: "\u2588", barIncompleteChar: "\u2591", hideCursor: true, synchronousUpdate: false, }); this.bar.start(100, this.progressValue, { budget: "100", }); } updateProgressBar(value, budget) { this.progressValue = value; this.budgetValue = budget; this.bar.update(value, { budget: `${budget}`, }); } stopProgressBar() { this.showProgressBar = false; this.bar.stop(); } log(type, text) { (0, logger_1.getLogger)()[type](text); } debug(text) { this.log("debug", text); } info(text) { this.log("info", text); } error(text) { this.log("error", text); } report(text, args) { this.info(`${text}: ${args.join(", ")}`); } } exports.CommandLineInterface = CommandLineInterface; //# sourceMappingURL=CommandLineInterface.js.map