Closed cmoussa1 closed 3 weeks ago
If it is helpful, there's examples of how to subclass the flux.util.OutputFormat
class to easily add a -o, --format
option to a command in the flux-core codebase.
The simplest example might be the HKFormat class in flux-housekeeping.py
Note also the subclass of UtilConfig
used to store a couple default formats. This also allows users to register their own formats by name in system-wide or per-user config files
flux-accounting now has its own AccountingFormatter
class with some common utility for printing out the results of a SQL query in both JSON or table format, so I'll go ahead and close this issue. I'll re-open more specific issues if they come up in the future.
Some great feedback given in #514 was to perhaps replicate flux-core's use of a format string when viewing data so that the user can customize the fields when looking at certain data, especially if it has many columns, like the
association_table
in the flux-accounting DB.