Skip to content

table

Source

Hook for creating tables with rich - github.com/willmcgugan/rich.

Inputs

Name Type Default Required Description
column_names List [] True List of column names
sort bool False True Boolean to sort contents or contents_split
contents Any None False List of lists to put into columns / rows
contents_split List None False List of strings to separate into columns based on separator
separator str None False A string to separate the strings in the contents

Returns

None

Examples

Basic table

Creating a table example that shows in the terminal

column_names:
  - stuff
  - things

data:
  - [ 'foo', 'bar' ]
  - [ 'here', 1 ]

table:
  ->: table
  column_names: "{{ column_names }}"
  contents: "{{ data }}"

┏━━━━━━━┳━━━━━━━━┓
┃ stuff ┃ things ┃
┡━━━━━━━╇━━━━━━━━┩
│ foo   │ bar    │
│ here  │ 1      │
└───────┴────────┘