class Chef::Knife::SupermarketList
def get_cookbook_list(items = 9999999, start = 0, cookbook_collection = {})
def get_cookbook_list(items = 9999999, start = 0, cookbook_collection = {}) cookbooks_url = "#{config[:supermarket_site]}/api/v1/cookbooks?items=#{items}&start=#{start}" cookbooks_url << "&order=#{config[:sort_by]}" if config[:sort_by] cookbooks_url << "&user=#{config[:owned_by]}" if config[:owned_by] cr = noauth_rest.get(cookbooks_url) cr["items"].each do |cookbook| cookbook_collection[cookbook["cookbook_name"]] = cookbook["cookbook"] end new_start = start + items if new_start < cr["total"] get_cookbook_list(items, new_start, cookbook_collection) else cookbook_collection end end
def run
def run if config[:with_uri] ui.output(format_for_display(get_cookbook_list)) else ui.msg(ui.list(get_cookbook_list.keys, :columns_down)) end end