Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/cliffy/mod.ts>Table

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
Extremely Popular
Go to Latest
class Table
extends Array<T>
import { Table } from "https://deno.land/x/cliffy@v0.19.0/mod.ts";

Table representation.

Type Parameters

optional
T extends IRow = IRow

Properties

private
optional
headerRow: Row
protected
options: ITableSettings

Methods

body(rows: T[]): this

Set table body.

border(enable: boolean, override?): this

Enable/disable cell border.

chars(chars: IBorderOptions): this

Set border characters.

Clone table recursively with header and options.

fromJson(rows: IDataRow[]): this

Read data from an array of json objects. An object represents a row and each property a column.

getBody(): T[]

Get table body.

getBorder(): boolean

Check if table has border.

getHeader(): Row | undefined

Get table header.

getIndent(): number

Get table indentation.

getMaxColWidth(): number | number[]

Get mac col widrth.

getMinColWidth(): number | number[]

Get min col width.

getPadding(): number | number[]

Get cell padding.

hasBodyBorder(): boolean

Check if table bordy has border.

hasBorder(): boolean

Check if table header or body has border.

hasHeaderBorder(): boolean

Check if header row has border.

header(header: IRow): this

Set table header.

indent(width: number, override?): this

Set table indentation.

maxColWidth(width: number | number[], override?): this

Set max col with.

minColWidth(width: number | number[], override?): this

Set min col width.

padding(padding: number | number[], override?): this

Set cell padding.

render(): this

Write table to stdout.

toString(): string

Generate table string.

Static Properties

protected
_chars: IBorder

Static Methods

chars(chars: IBorderOptions): Table

Set global default border characters.

from<T extends IRow>(rows: ITable<T>): Table<T>

Create a new table. If rows is a table, all rows and options of the table will be copied to the new table.

Create a new table from an array of json objects. An object represents a row and each property a column.

render<T extends IRow>(rows: ITable<T>): void

Write table or rows to stdout.