This document covers two of the the CLI Consumer’s output types.
--output tablewhich is a simple formatted table--output full-tablewhich is a text-based user interface, with features such as live row-based updates, and column customization viatable-format
To demonstrate the table output, we’re going to use the following input
Example initial topic input
{"key1":"a","key2":"1","key3":"Alice","id":123}
{"key1":"b","key2":"2","key3":"Bob","id":456}
{"key1":"c","key2":"3","key3":"Carol","id":789}
[{"key1":"x","key2":"10","key3":"Alice","id":123},{"key1":"y","key2":"20","key3":"Bob","id":456},{"key1":"c","key2":"30","key3":"Carol","id":789}]
The expected shape of the data is either:
- a JSON object
- a JSON array of objects
By default the top-level object keys will be used as the column names, sorted by alphabetical order. For more customizability, please use the full-table output
Example command:
$ fluvio consume example-topic --output table -B
Example output:
id | key1 | key2 | key3
123 | a | 1 | Alice
456 | b | 2 | Bob
789 | c | 3 | Carol
123 | x | 10 | Alice
456 | y | 20 | Bob
789 | c | 30 | Carol
By default the top-level object keys will be used as the column names, sorted by alphabetical order.
Example command:
$ fluvio consume example-topic --output full-table -B
Example output:
┌('c' to clear table | 'q' or ESC to exit) | Items: 6─────────────────┐
│id key1 key2 key3 │
│123 a 1 Alice │
│456 b 2 Bob │
│789 c 3 Carol │
│123 x 10 Alice │
│456 y 20 Bob │
│789 c 30 Carol │
└─────────────────────────────────────────────────────────────────────┘
You can scroll with
up/downarrow keys or the mouse scroll wheel to move one row at a timePage up/Page downto move 5 rows up/down at a timeHometo move to the top of the tableEndto move to the bottom of the tablecto clear the table stateqorESCto exit the table
You may have json data that isn’t most effectively displayed with the keys ordered alphabetically. Or your data is event sourced, and you only want to see the most recent data organized by one or more primary keys.
In that case, to customize the full-table output, you can provide the name of your table-format.
fluvio consume <topic-name> --output full-table --table-format <table-format name>
For more information about how to use table-format to customize your table display (including how to rename and/or rearrange columns, or how to configure primary keys for row updating)