proposal to output more than one tables

Bug #1739657 reported by Mikhail
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cliff
New
Undecided
Unassigned

Bug Description

Cliff provides great ways to draw table about one object (Show) or many equals objects. (List)
But, sometimes I have a difficult JSON that would be better to split into two or many tables.
For example, I have a daemon that fetches a data from services. Daemon provides API for getting information about current fetcher state (is fetching already started) and history (when was running)
A simple example of the answer:

{
  "current_fetches": {
    "monitoring": false,
    "storage": false,
  },
  "last_fetches": [
    {
      "date": "2017-08-01T12:00:00",
      "service": "monitoring"
    },
    {
      "date": "2017-08-01T12:00:00",
      "service": "storage"
    }
  ]
}

Would be great to draw like

+-------+------------+
| Field | Value |
+------------+-------+
| storage | false |
| monitoring | false |
+------------+-------+
+---------------------+------------+
| date | service |
+---------------------+------------+
| 2017-08-01T12:00:00 | monitoring |
| 2017-08-01T12:00:00 | storage |
+---------------------+------------+

But I haven't found a way to draw more than 1 table.

Revision history for this message
Mikhail (objque) wrote :

Now I have a custom command class that inherits from cliff.Command and cliff.TableFormatter.
This solution works fine for me, but I've lost possibility call different formatters

Revision history for this message
Doug Hellmann (doug-hellmann) wrote :

I think using the custom command and formatter is the expected way to do this, although I can see how it's not as ideal if you consider some of the standard formatters to still be useful.

Can you think of a generic way to express the idea that there might be multiple tables in a given set of output? If so, maybe we could have the show command class choose between a table and a "multi-table" formatter somehow.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.