cli-block
Version:
Create nice looking CLI Blocks
173 lines (172 loc) • 8.1 kB
TypeScript
import { LoggerSettings } from "../types";
/**
* Creates a formatted line or multiple lines of text with optional prefix and indentation.
* @param {string | string[] | null} msg - The message to display. Can be a single string, array of strings, or null for an empty line.
* @param {Object} options - Configuration options for the line.
* @param {boolean} [options.useBlock=false] - Whether to use block formatting.
* @param {number} [options.indent=0] - Number of spaces to indent the line.
* @param {Partial<LoggerSettings>} [options] - Additional logger settings.
* @returns {string[]} Array of formatted lines.
*/
export declare const createLine: (msg?: string | null | Array<string>, options?: Partial<LoggerSettings> & {
useBlock?: boolean;
indent?: number;
}) => string[];
/**
* Displays a success message with a green checkmark (✔) prefix.
* @param {string | string[]} msg - The message to display. Can be a single string or array of strings.
* @param {Object} options - Configuration options for the line.
* @param {boolean} [options.useBlock=false] - Whether to use block formatting.
* @param {number} [options.indent=0] - Number of spaces to indent the line.
* @param {Partial<LoggerSettings>} [options] - Additional logger settings.
* @example
* success("Operation completed successfully");
* // Output: ✔ Operation completed successfully
*/
export declare const success: (msg: string | string[], options?: Partial<LoggerSettings> & {
useBlock?: boolean;
indent?: number;
}) => void;
/**
* Displays an error message with a red cross (×) prefix.
* @param {string | string[]} msg - The message to display. Can be a single string or array of strings.
* @param {Object} options - Configuration options for the line.
* @param {boolean} [options.useBlock=false] - Whether to use block formatting.
* @param {number} [options.indent=0] - Number of spaces to indent the line.
* @param {Partial<LoggerSettings>} [options] - Additional logger settings.
* @example
* error("Operation failed");
* // Output: × Operation failed
*/
export declare const error: (msg: string | string[], options?: Partial<LoggerSettings> & {
useBlock?: boolean;
indent?: number;
}) => void;
/**
* Displays a warning message with a yellow exclamation mark (!) prefix.
* @param {string | string[]} msg - The message to display. Can be a single string or array of strings.
* @param {Object} options - Configuration options for the line.
* @param {boolean} [options.useBlock=false] - Whether to use block formatting.
* @param {number} [options.indent=0] - Number of spaces to indent the line.
* @param {Partial<LoggerSettings>} [options] - Additional logger settings.
* @example
* warn("Deprecated feature used");
* // Output: ! Deprecated feature used
*/
export declare const warn: (msg: string | string[], options?: Partial<LoggerSettings> & {
useBlock?: boolean;
indent?: number;
}) => void;
/**
* Displays an info message with a blue info (i) prefix.
* @param {string | string[]} msg - The message to display. Can be a single string or array of strings.
* @param {Object} options - Configuration options for the line.
* @param {boolean} [options.useBlock=false] - Whether to use block formatting.
* @param {number} [options.indent=0] - Number of spaces to indent the line.
* @param {Partial<LoggerSettings>} [options] - Additional logger settings.
* @example
* info("Processing files...");
* // Output: i Processing files...
*/
export declare const info: (msg: string | string[], options?: Partial<LoggerSettings> & {
useBlock?: boolean;
indent?: number;
}) => void;
/**
* Displays a plain text message without any prefix.
* @param {string | string[]} msg - The message to display. Can be a single string or array of strings.
* @param {Object} options - Configuration options for the line.
* @param {boolean} [options.useBlock=false] - Whether to use block formatting.
* @param {number} [options.indent=0] - Number of spaces to indent the line.
* @param {Partial<LoggerSettings>} [options] - Additional logger settings.
* @example
* line("Simple text message");
* // Output: Simple text message
*/
export declare const line: (msg: string | string[], options?: Partial<LoggerSettings> & {
useBlock?: boolean;
indent?: number;
}) => void;
/**
* Displays a success message within a bordered block.
* @param {string | string[]} msg - The message to display. Can be a single string or array of strings.
* @param {Object} options - Configuration options for the line.
* @param {number} [options.indent=0] - Number of spaces to indent the block.
* @param {Partial<LoggerSettings>} [options] - Additional logger settings.
* @example
* blockSuccess("Operation completed successfully");
* // Output: │ ✔ Operation completed successfully │
*/
export declare const blockSuccess: (msg: string | string[], options?: Partial<LoggerSettings> & {
useBlock?: boolean;
indent?: number;
}) => void;
/**
* Displays an error message within a bordered block.
* @param {string | string[]} msg - The message to display. Can be a single string or array of strings.
* @param {Object} options - Configuration options for the line.
* @param {number} [options.indent=0] - Number of spaces to indent the block.
* @param {Partial<LoggerSettings>} [options] - Additional logger settings.
* @example
* blockError("Operation failed");
* // Output: │ × Operation failed │
*/
export declare const blockError: (msg: string | string[], options?: Partial<LoggerSettings> & {
useBlock?: boolean;
indent?: number;
}) => void;
/**
* Displays a warning message within a bordered block.
* @param {string | string[]} msg - The message to display. Can be a single string or array of strings.
* @param {Object} options - Configuration options for the line.
* @param {number} [options.indent=0] - Number of spaces to indent the block.
* @param {Partial<LoggerSettings>} [options] - Additional logger settings.
* @example
* blockWarn("Deprecated feature used");
* // Output: │ ! Deprecated feature used │
*/
export declare const blockWarn: (msg: string | string[], options?: Partial<LoggerSettings> & {
useBlock?: boolean;
indent?: number;
}) => void;
/**
* Displays an info message within a bordered block.
* @param {string | string[]} msg - The message to display. Can be a single string or array of strings.
* @param {Object} options - Configuration options for the line.
* @param {number} [options.indent=0] - Number of spaces to indent the block.
* @param {Partial<LoggerSettings>} [options] - Additional logger settings.
* @example
* blockInfo("Processing files...");
* // Output: │ i Processing files... │
*/
export declare const blockInfo: (msg: string | string[], options?: Partial<LoggerSettings> & {
useBlock?: boolean;
indent?: number;
}) => void;
/**
* Displays a plain text message within a bordered block.
* @param {string | string[]} msg - The message to display. Can be a single string or array of strings.
* @param {Object} options - Configuration options for the line.
* @param {number} [options.indent=0] - Number of spaces to indent the block.
* @param {Partial<LoggerSettings>} [options] - Additional logger settings.
* @example
* blockLine("Simple text message");
* // Output: │ Simple text message │
*/
export declare const blockLine: (msg: string | string[], options?: Partial<LoggerSettings> & {
useBlock?: boolean;
indent?: number;
}) => void;
/**
* Display a file typed message with a file icon prefix.
* @param {string | string[]} msg - The message to display. Can be a single string or array of strings.
* @param {Object} options - Configuration options for the line.
* @param {boolean} [options.useBlock=false] - Whether to use block formatting.
* @param {Partial<LoggerSettings>} [options] - Additional logger settings.
* @example
* file("index.ts");
* // Output: 📄 index.ts
*/
export declare const file: (msg: string | string[], options?: Partial<LoggerSettings> & {
useBlock?: boolean;
}) => void;