UNPKG

1.71 kBTypeScriptView Raw
1import * as Interfaces from '@oclif/core/lib/interfaces';
2export declare function table<T extends Record<string, unknown>>(data: T[], columns: table.Columns<T>, options?: table.Options): void;
3export declare namespace table {
4 export const Flags: {
5 columns: Interfaces.OptionFlag<string | undefined>;
6 sort: Interfaces.OptionFlag<string | undefined>;
7 filter: Interfaces.OptionFlag<string | undefined>;
8 csv: Interfaces.Flag<boolean>;
9 output: Interfaces.OptionFlag<string | undefined>;
10 extended: Interfaces.Flag<boolean>;
11 'no-truncate': Interfaces.Flag<boolean>;
12 'no-header': Interfaces.Flag<boolean>;
13 };
14 type IFlags = typeof Flags;
15 type ExcludeFlags<T, Z> = Pick<T, Exclude<keyof T, Z>>;
16 type IncludeFlags<T, K extends keyof T> = Pick<T, K>;
17 export function flags(): IFlags;
18 export function flags<Z extends keyof IFlags = keyof IFlags>(opts: {
19 except: Z | Z[];
20 }): ExcludeFlags<IFlags, Z>;
21 export function flags<K extends keyof IFlags = keyof IFlags>(opts: {
22 only: K | K[];
23 }): IncludeFlags<IFlags, K>;
24 export interface Column<T extends Record<string, unknown>> {
25 header: string;
26 extended: boolean;
27 minWidth: number;
28 get(row: T): any;
29 }
30 export type Columns<T extends Record<string, unknown>> = {
31 [key: string]: Partial<Column<T>>;
32 };
33 export interface Options {
34 [key: string]: any;
35 sort?: string;
36 filter?: string;
37 columns?: string;
38 extended?: boolean;
39 'no-truncate'?: boolean;
40 output?: string;
41 'no-header'?: boolean;
42 printLine?(s: any): any;
43 }
44 export {};
45}