π Sid Gifari File Manager Pro
v8.0.5 | 2026-06-15 00:44:59 | PHP 8.1.34
π
/ (Root)
/
opt
/
alt
/
alt-nodejs9
/
root
/
usr
/
lib
/
node_modules
/
npm
/
node_modules.bundled
/
cli-table2
π /opt/alt/alt-nodejs9/root/usr/lib/node_modules/npm/node_modules.bundled/cli-table2
π Refresh
βοΈ
Editing: basic-usage.md
Read Only
##### Basic Usage  ```javascript // By default, headers will be red, and borders will be grey var table = new Table({head:['a','b']}); table.push(['c','d']); ``` ##### Basic Usage - disable colors - (used often in the examples and tests) ββββββββ¬ββββββββββββββββββββββ¬ββββββββββββββββββββββββββ¬ββββββββββββββββββ β Rel β Change β By β When β ββββββββΌββββββββββββββββββββββΌββββββββββββββββββββββββββΌββββββββββββββββββ€ β v0.1 β Testing something β¦ β rauchg@gmail.com β 7 minutes ago β ββββββββΌββββββββββββββββββββββΌββββββββββββββββββββββββββΌββββββββββββββββββ€ β v0.1 β Testing something β¦ β rauchg@gmail.com β 8 minutes ago β ββββββββ΄ββββββββββββββββββββββ΄ββββββββββββββββββββββββββ΄ββββββββββββββββββ ```javascript // For most of these examples, and most of the unit tests we disable colors. // It makes unit tests easier to write/understand, and allows these pages to // display the examples as text instead of screen shots. var table = new Table({ head: ['Rel', 'Change', 'By', 'When'] , style: { head: [] //disable colors in header cells , border: [] //disable colors for the border } , colWidths: [6, 21, 25, 17] //set the widths of each column (optional) }); table.push( ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '7 minutes ago'] , ['v0.1', 'Testing something cool', 'rauchg@gmail.com', '8 minutes ago'] ); ``` ##### Create vertical tables by adding objects a that specify key-value pairs ββββββ¬βββββββββββββββββββββββ βv0.1βTesting something coolβ ββββββΌβββββββββββββββββββββββ€ βv0.1βTesting something coolβ ββββββ΄βββββββββββββββββββββββ ```javascript var table = new Table({ style: {'padding-left':0, 'padding-right':0, head:[], border:[]} }); table.push( {'v0.1': 'Testing something cool'} , {'v0.1': 'Testing something cool'} ); ``` ##### Cross tables are similar to vertical tables, but include an empty string for the first header ββββββββββ¬βββββββββ¬βββββββββββββββββββββββ β βHeader 1βHeader 2 β ββββββββββΌβββββββββΌβββββββββββββββββββββββ€ βHeader 3βv0.1 βTesting something coolβ ββββββββββΌβββββββββΌβββββββββββββββββββββββ€ βHeader 4βv0.1 βTesting something coolβ ββββββββββ΄βββββββββ΄βββββββββββββββββββββββ ```javascript var table = new Table({ head: ["", "Header 1", "Header 2"], style: {'padding-left':0, 'padding-right':0, head:[], border:[]} }); // clear styles to prevent color output table.push( {"Header 3": ['v0.1', 'Testing something cool'] } , {"Header 4": ['v0.1', 'Testing something cool'] } ); ``` ##### Stylize the table with custom border characters ββββββββ€ββββββ€βββββββ β foo β bar β baz β ββββββββΌββββββΌβββββββ’ β frob β bar β quuz β ββββββββ§ββββββ§βββββββ ```javascript var table = new Table({ chars: { 'top': 'β' , 'top-mid': 'β€' , 'top-left': 'β' , 'top-right': 'β' , 'bottom': 'β' , 'bottom-mid': 'β§' , 'bottom-left': 'β' , 'bottom-right': 'β' , 'left': 'β' , 'left-mid': 'β' , 'right': 'β' , 'right-mid': 'β’' }, style: { head: [] , border: [] } }); table.push( ['foo', 'bar', 'baz'] , ['frob', 'bar', 'quuz'] ); ``` ##### Use ansi colors (i.e. colors.js) to style text within the cells at will, even across multiple lines  ```javascript var table = new Table({style:{border:[],header:[]}}); table.push([ colors.red('Hello\nhow\nare\nyou?'), colors.blue('I\nam\nfine\nthanks!') ]); ``` ##### Set `wordWrap` to true to make lines of text wrap instead of being truncated βββββββββ¬ββββββββββ β Hello β I am β β how β fine β β are β thanks! β β you? β β βββββββββ΄ββββββββββ ```javascript var table = new Table({ style:{border:[],header:[]}, colWidths:[7,9], wordWrap:true }); table.push([ 'Hello how are you?', 'I am fine thanks!' ]); ```
πΎ Save Changes
β Cancel