@swell/cli
Version:
Swell's command line interface/utility
30 lines (29 loc) • 1.28 kB
TypeScript
export interface GroupInfo {
/** Grouping identity. Rows with the same slug land in the same section. */
slug: string;
/** Divider text. Defaults to `slug` when omitted. */
label?: string;
/** Sort priority; lower renders first. Ties preserve insertion order. Default 1. */
order?: number;
}
export interface KeyMetaRow {
/** Paste-back identifier rendered as column 1. */
key: string;
/** Optional compact status string. Empty or undefined renders the key alone. */
meta?: string;
/** Optional group; when some rows carry one, multiple groups produce dividers. */
group?: GroupInfo;
}
/**
* Render a two-column list: paste-back key + optional compact meta string.
*
* - Rows with meta render as ` <key-padded> <meta>`.
* - Rows without meta render as ` <key>` with no trailing whitespace.
* - Key column width is computed globally across all rows so meta columns
* align vertically.
* - Rows with a `group` are collected into sections; sections are separated
* by a blank line and a `── <label>` divider. Sections sort by `order`
* (lower first), ties preserve insertion order. A single group collapses
* to a flat listing.
*/
export declare function renderKeyMetaTable(rows: KeyMetaRow[]): string[];