diff options
Diffstat (limited to 'cliff')
-rw-r--r-- | cliff/show.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cliff/show.py b/cliff/show.py index 39e94b1..855b2d2 100644 --- a/cliff/show.py +++ b/cliff/show.py @@ -44,3 +44,12 @@ class ShowOne(DisplayCommandBase): self.app.stdout, parsed_args) return 0 + + def dict2columns(self, data): + """Implement the common task of converting a dict-based object + to the two-column output that ShowOne expects. + """ + if not data: + return ({}, {}) + else: + return zip(*sorted(data.items())) |