@quenty/cli-output-helpers
Version:
Helpers to generate Nevermore package and game templates
98 lines • 3.02 kB
TypeScript
export type BoxOptions = {
centered?: boolean;
};
export interface OutputBuffer {
lines: string[];
}
/**
* Helps with output
*/
export declare class OutputHelper {
private static _verbose;
/**
* Formats the error with markup
* @param message Message to format
* @returns Formatted string
*/
static formatError(message: string): string;
/**
* Formats the information message
* @param message Message to format
* @returns Formatted string
*/
static formatInfo(message: string): string;
/**
* Formats a warning message
* @param message Message to format
* @returns Formatted string
*/
static formatWarning(message: string): string;
/**
* Formats the information
* @param message Message to format
* @returns Formatted string
*/
static formatDescription(message: string): string;
/**
* Formats the hint message
* @param message Message to format
* @returns Formatted string
*/
static formatHint(message: string): string;
static formatDim(message: string): string;
static formatSuccess(message: string): string;
private static _hasAnsi;
/** Strip ANSI escape codes from terminal output. */
static stripAnsi: (text: string) => string;
/**
* Helper method to put a box around the output
*/
static formatBox(message: string, options?: BoxOptions): string;
/**
* Logs information to the console
* @param message Message to write
*/
static error(message: string): void;
/**
* Logs information to the console
* @param message Message to write
*/
static info(message: string): void;
/**
* Sets whether verbose messages are printed.
* Defaults to true. Batch runners set this to false to suppress
* intermediate messages during concurrent execution.
*/
static setVerbose(verbose: boolean): void;
/**
* Logs a verbose/intermediate message. Suppressed when verbose is false.
* When running inside a buffered context (see runBuffered), messages are
* captured to the buffer instead of printed.
*/
static verbose(message: string): void;
/**
* Run an async function with output buffering. All OutputHelper.verbose()
* calls inside the function are captured and returned alongside the result.
* Used by batch runners to collect per-package output without interleaving.
*/
static runBuffered<T>(fn: () => Promise<T>): Promise<{
result: T;
output: string[];
}>;
/**
* Logs warning to the console
* @param message Message to write
*/
static warn(message: string): void;
/**
* Logs hint to the console
* @param message Message to write
*/
static hint(message: string): void;
/**
* Renders a box around the message
* @param message
*/
static box(message: string, options?: BoxOptions): void;
}
//# sourceMappingURL=outputHelper.d.ts.map