table for viewers

Render the table.

Signature

> table --start-number --list --width --expand --expand-deep --flatten --flatten-separator --collapse

Parameters

  • --start-number {int}: row number to start viewing from
  • --list (-l): list available table modes/themes
  • --width {int}: number of terminal columns wide (not output columns)
  • --expand (-e): expand the table structure in a light mode
  • --expand-deep {int}: an expand limit of recursion which will take place
  • --flatten (-): Flatten simple arrays
  • --flatten-separator {string}: sets a separator when 'flatten' used
  • --collapse (-c): expand the table structure in collapse mode. Be aware collapse mode currently doesn't support width control

Input/output types:

inputoutput
anyany

Examples

List the files in current directory, with indexes starting from 1.

> ls | table -n 1

Render data in table view

> [[a b]; [1 2] [3 4]] | table
╭───┬───┬───╮
│ # │ a │ b │
├───┼───┼───┤
│ 012 │
│ 134 │
╰───┴───┴───╯

Render data in table view (expanded)

> [[a b]; [1 2] [2 [4 4]]] | table --expand
╭───┬───┬───╮
│ # │ a │ b │
├───┼───┼───┤
│ 012 │
│ 134 │
╰───┴───┴───╯

Render data in table view (collapsed)

> [[a b]; [1 2] [2 [4 4]]] | table --collapse
╭───┬───┬───╮
│ # │ a │ b │
├───┼───┼───┤
│ 012 │
│ 134 │
╰───┴───┴───╯

Notes

If the table contains a column called 'index', this column is used as the table index instead of the usual continuous index.