Skip to content

Latest commit

 

History

History

table

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Cliffy ❯ Table

Version Release date deno Build status issues Licence

Easy solution to render table's on the command line
>_ Create cli table's with border, padding, nested table's, etc...

Usage

Simple table:

import { Table } from 'https://deno.land/x/cliffy/table.ts';

Table.from( [
        [ 'Flags', 'Description', 'Types' ],
        [ 'cell1', 'cell2', 'cell3' ],
        [ 'cell1', 'cell2', 'cell3' ],
        [ 'cell1', 'cell2', 'cell3' ]
    ] )
    .maxCellWidth( 50 )
    .padding( 1 )
    .indent( 2 )
    .border( true )
    .render();
  ┌───────┬─────────────┬───────┐
  │ Flags │ Description │ Types │
  ├───────┼─────────────┼───────┤
  │ cell1 │ cell2       │ cell3 │
  ├───────┼─────────────┼───────┤
  │ cell1 │ cell2       │ cell3 │
  ├───────┼─────────────┼───────┤
  │ cell1 │ cell2       │ cell3 │
  └───────┴─────────────┴───────┘

Multiline rows:

import { Table } from 'https://deno.land/x/cliffy/table.ts';

Table.from( [
        [ 'Flags', 'Description', 'Types' ],
        [ 'cell1', 'cell2', 'cell3' ],
        [ 'cell1', 'Lorem ipsum dolor sit amet, at nam scripta fierent imperdiet. Et vim eruditi definitiones, quo cu accusamus mediocritatem. Graeci sapientem et eum. Cu dicat vivendum qui, ius percipit conceptam ne. Magna veniam ut his.', 'cell3' ],
        [ 'cell1', 'cell2', 'cell3' ]
    ] )
    .maxCellWidth( [ 10, 40, 10 ] )
    .padding( 1 )
    .indent( 2 )
    .border( true )
    .render();
  ┌───────┬────────────────────────────────────┬───────┐
  │ Flags │ Description                        │ Types │
  ├───────┼────────────────────────────────────┼───────┤
  │ cell1 │ cell2                              │ cell3 │
  ├───────┼────────────────────────────────────┼───────┤
  │ cell1 │ Lorem ipsum dolor sit amet, at nam │ cell3 │
  │       │ scripta fierent imperdiet. Et vim  │       │
  │       │ eruditi definitiones, quo cu       │       │
  │       │ accusamus mediocritatem. Graeci    │       │
  │       │ sapientem et eum. Cu dicat         │       │
  │       │ vivendum qui, ius percipit         │       │
  │       │ conceptam ne. Magna veniam ut his. │       │
  ├───────┼────────────────────────────────────┼───────┤
  │ cell1 │ cell2                              │ cell3 │
  └───────┴────────────────────────────────────┴───────┘

License

MIT