UNPKG

1.6 kBTypeScriptView Raw
1import sliceAnsi = require('slice-ansi');
2import stringWidth = require('string-width');
3import stripAnsi = require('strip-ansi');
4export { sliceAnsi, stringWidth, stripAnsi };
5export declare const TTY_WIDTH: number;
6export declare function indent(n?: number): string;
7export interface WordWrapOptions {
8 width?: number;
9 indentation?: number;
10 append?: string;
11}
12export declare function wordWrap(msg: string, { width, indentation, append }: WordWrapOptions): string;
13export declare function prettyPath(p: string): string;
14export declare function expandPath(p: string): string;
15export declare function generateFillSpaceStringList(list: string[], optimalLength?: number, fillCharacter?: string): string[];
16export interface ColumnarOptions {
17 hsep?: string;
18 vsep?: string;
19 headers?: string[];
20}
21/**
22 * Basic CLI table generator with support for ANSI colors.
23 *
24 * @param rows 2-dimensional matrix containing cells. An array of columns,
25 * which are arrays of cells.
26 * @param options.vsep The vertical separator character, default is
27 * `chalk.dim('|')`. Supply an empty string to hide
28 * the separator altogether.
29 * @param options.hsep The horizontal separator character, default is
30 * `chalk.dim('-')`. This is used under the headers,
31 * if supplied. Supply an empty string to hide the
32 * separator altogether.
33 * @param options.headers An array of header cells.
34 */
35export declare function columnar(rows: string[][], { hsep, vsep, headers }: ColumnarOptions): string;