summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNuo Yan <nuo@opscode.com>2011-04-08 13:33:16 -0700
committerNuo Yan <nuo@opscode.com>2011-04-08 13:33:16 -0700
commitdf4ce624ea76207e4dc2703d2fe9466a13fce1b0 (patch)
tree6a946ba67dd952fc5ae4792067ce64f22f72eea6
parent9fdb0a1ee93ae878448cc0fced0b17b730e0efba (diff)
downloadchef-df4ce624ea76207e4dc2703d2fe9466a13fce1b0.tar.gz
fix knife cookbook list when there is no cookbook
-rw-r--r--chef/lib/chef/knife/core/generic_presenter.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/chef/lib/chef/knife/core/generic_presenter.rb b/chef/lib/chef/knife/core/generic_presenter.rb
index 3823f7111a..2256a1f897 100644
--- a/chef/lib/chef/knife/core/generic_presenter.rb
+++ b/chef/lib/chef/knife/core/generic_presenter.rb
@@ -53,7 +53,7 @@ class Chef
# Returns a String representation of +data+ that is suitable for output
# to a terminal or perhaps for data interchange with another program.
- # The representation of the +data+ depends on the value of the
+ # The representation of the +data+ depends on the value of the
# `config[:format]` setting.
def format(data)
case parse_format_option
@@ -171,7 +171,7 @@ class Chef
collected[cookbook] = versions["versions"].map {|v| v['version']}
collected
end
- key_length = versions_by_cookbook.keys.map {|name| name.size }.max + 2
+ key_length = versions_by_cookbook.empty? ? 0 : versions_by_cookbook.keys.map {|name| name.size }.max + 2
versions_by_cookbook.sort.map do |cookbook, versions|
"#{cookbook.ljust(key_length)} #{versions.join(',')}"
end