    # File lib/chef/knife/cookbook_metadata.rb, line 44
          def run
            config[:cookbook_path] ||= Chef::Config[:cookbook_path]

            if config[:all]
              cl = Chef::CookbookLoader.new(config[:cookbook_path])
              cl.each do |cname, cookbook|
                generate_metadata(cname.to_s)
              end
            else
              cookbook_name = @name_args[0]
              if cookbook_name.nil? || cookbook_name.empty?
                ui.error "You must specify the cookbook to generate metadata for, or use the --all option."
                exit 1
              end
              generate_metadata(cookbook_name)
            end
          end