summaryrefslogtreecommitdiff
path: root/cliff/show.py
diff options
context:
space:
mode:
authorRui Chen <chenrui.momo@gmail.com>2016-02-24 15:46:17 +0800
committerRui Chen <chenrui.momo@gmail.com>2016-04-20 03:24:10 +0000
commit15f60bf3989b65bfe3fc450959ab9076e3ff5173 (patch)
tree407cfb27bc1116a58278070ba787dc134145c0c9 /cliff/show.py
parent80f22a116a40e6b51b919816b8c13a3fe1c2eadb (diff)
downloadcliff-15f60bf3989b65bfe3fc450959ab9076e3ff5173.tar.gz
Distinguish no existed columns in ShowOne
If we show a resource with no existed column, ShowOne command don't raise any warning and notify that we are doing some wrong things, the suitable behavior should be like as Lister command, output the no recognized column names. Change-Id: I5a698653a683c00dd3e3e41c3b381f3d4dac2c08 Closes-Bug: #1548701
Diffstat (limited to 'cliff/show.py')
-rw-r--r--cliff/show.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/cliff/show.py b/cliff/show.py
index e766076..57e1e70 100644
--- a/cliff/show.py
+++ b/cliff/show.py
@@ -27,14 +27,9 @@ class ShowOne(DisplayCommandBase):
"""
def produce_output(self, parsed_args, column_names, data):
- if not parsed_args.columns:
- columns_to_include = column_names
- else:
- columns_to_include = [c for c in column_names
- if c in parsed_args.columns]
- # Set up argument to compress()
- selector = [(c in columns_to_include)
- for c in column_names]
+ (columns_to_include, selector) = self._generate_columns_and_selector(
+ parsed_args, column_names)
+ if selector:
data = list(self._compress_iterable(data, selector))
self.formatter.emit_one(columns_to_include,
data,