summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/knife/search.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/chef/knife/search.rb b/lib/chef/knife/search.rb
index 2a68ec5108..2ab1ad21cd 100644
--- a/lib/chef/knife/search.rb
+++ b/lib/chef/knife/search.rb
@@ -98,7 +98,9 @@ class Chef
begin
q.search(@type, @query, search_args) do |item|
formatted_item = Hash.new
- if item.is_a?(Hash)
+ if config[:id_only]
+ formatted_item = format_for_display({ 'id' => item["__display_name"] })
+ elsif item.is_a?(Hash)
# doing a little magic here to set the correct name
formatted_item[item["__display_name"]] = item.reject { |k| k == "__display_name" }
else