Skip to content

Commit

Permalink
docs(table): add table examples
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar committed Apr 13, 2020
1 parent 5f203d1 commit e7c1761
Show file tree
Hide file tree
Showing 10 changed files with 453 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/table/multiline-border-table.ts
@@ -0,0 +1,12 @@
#!/usr/bin/env -S deno --allow-env

import { Table } from '../../packages/table/lib/table.ts';

Table.from( [
[ 'Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.', 'cell2', 'cell3' ],
[ 'cell1', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.', 'cell3' ],
[ 'cell1', 'cell2', 'At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.' ]
] )
.maxCellWidth( 20 )
.border( true )
.render();
80 changes: 80 additions & 0 deletions examples/table/multiline-nested-border-table.ts
@@ -0,0 +1,80 @@
#!/usr/bin/env -S deno --allow-env

import { Table } from '../../packages/table/lib/table.ts';

Table.render( [ [
Table.from( [
[ 'sed diam nonumy eirmod tempor invidunt ut labore.', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.maxCellWidth( 20 )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr.', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.maxCellWidth( 20 )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.maxCellWidth( 20 )
.border( true )
.toString()
], [
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'takimata sanctus est Lorem ipsum.', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.maxCellWidth( 20 )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'Stet clita kasd gubergren, no sea takimata.', 'cell2', 'cell3' ]
] )
.maxCellWidth( 20 )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'sanctus est Lorem ipsum dolor sit.' ]
] )
.maxCellWidth( 20 )
.border( true )
.toString()
], [
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'sed diam nonumy eirmod tempor invidunt ut labore.', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.maxCellWidth( 20 )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'accusam et justo duo.' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.maxCellWidth( 20 )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'Stet clita kasd gubergren, no sea takimata.', 'cell2', 'cell3' ]
] )
.maxCellWidth( 20 )
.border( true )
.toString()
] ] );
82 changes: 82 additions & 0 deletions examples/table/multiline-nested-table.ts
@@ -0,0 +1,82 @@
#!/usr/bin/env -S deno --allow-env

import { Table } from '../../packages/table/lib/table.ts';

Table.from( [ [
Table.from( [
[ 'sed diam nonumy eirmod tempor invidunt ut labore.', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.padding( 1 )
.maxCellWidth( 20 )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr.', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.padding( 1 )
.maxCellWidth( 20 )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.padding( 1 )
.maxCellWidth( 20 )
.toString()
], [
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'takimata sanctus est Lorem ipsum.', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.padding( 1 )
.maxCellWidth( 20 )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'Stet clita kasd gubergren, no sea takimata.', 'cell2', 'cell3' ]
] )
.padding( 1 )
.maxCellWidth( 20 )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'sanctus est Lorem ipsum dolor sit.' ]
] )
.padding( 1 )
.maxCellWidth( 20 )
.toString()
], [
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'sed diam nonumy eirmod tempor invidunt ut labore.', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.padding( 1 )
.maxCellWidth( 20 )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'accusam et justo duo.' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.padding( 1 )
.maxCellWidth( 20 )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'Stet clita kasd gubergren, no sea takimata.', 'cell2', 'cell3' ]
] )
.padding( 1 )
.maxCellWidth( 20 )
.toString()
] ] )
.padding( 1 )
.render();
12 changes: 12 additions & 0 deletions examples/table/multiline-table.ts
@@ -0,0 +1,12 @@
#!/usr/bin/env -S deno --allow-env

import { Table } from '../../packages/table/lib/table.ts';

Table.from( [
[ 'Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.', 'cell2', 'cell3' ],
[ 'cell1', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.', 'cell3' ],
[ 'cell1', 'cell2', 'At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.' ]
] )
.maxCellWidth( 20 )
.padding( 1 )
.render();
86 changes: 86 additions & 0 deletions examples/table/nested-tables.ts
@@ -0,0 +1,86 @@
#!/usr/bin/env -S deno --allow-env

import { Table } from '../../packages/table/lib/table.ts';

Table.render(
Table.from( [
[
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'Justo duo dolores et ea rebum.', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.maxCellWidth( 25 )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'Labore et dolore magna aliquyam erat.' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.maxCellWidth( 25 )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.maxCellWidth( 25 )
.border( true )
.toString()
],
[
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.maxCellWidth( 25 )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'Sed diam nonumy eirmod tempor invidunt ut labore.', 'cell2', 'cell3' ]
] )
.maxCellWidth( 25 )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.maxCellWidth( 25 )
.border( true )
.toString()
],
[
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.maxCellWidth( 25 )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.maxCellWidth( 25 )
.border( true )
.toString(),
Table.from( [
[ 'At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd.', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren.', 'cell3' ]
] )
.maxCellWidth( 25 )
.border( true )
.toString()
]
] )
);
15 changes: 15 additions & 0 deletions examples/table/padding-indent.ts
@@ -0,0 +1,15 @@
#!/usr/bin/env -S deno --allow-env

import { Table } from '../../packages/table/lib/table.ts';

Table.render(
Table.from( [
[ 'Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.', 'cell2', 'cell3' ],
[ 'cell1', 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.', 'cell3' ],
[ 'cell1', 'cell2', 'At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.' ]
] )
.indent( 5 )
.padding( 1 )
.maxCellWidth( 20 )
.border( true )
);
11 changes: 11 additions & 0 deletions examples/table/simple-border-table.ts
@@ -0,0 +1,11 @@
#!/usr/bin/env -S deno --allow-env

import { Table } from '../../packages/table/lib/table.ts';

Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.border( true )
.render();
71 changes: 71 additions & 0 deletions examples/table/simple-nested-border-table.ts
@@ -0,0 +1,71 @@
#!/usr/bin/env -S deno --allow-env

import { Table } from '../../packages/table/lib/table.ts';

Table.render( [ [
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.border( true )
.toString()
], [
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.border( true )
.toString()
], [
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.border( true )
.toString(),
Table.from( [
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ],
[ 'cell1', 'cell2', 'cell3' ]
] )
.border( true )
.toString()
] ] );

0 comments on commit e7c1761

Please sign in to comment.